Opens a stored procedure in an Access Data Project.
DoCmd.OpenStoredProcedure ProcedureName [, View ][, DataMode ]
with the following parameters:
ProcedureName
A String defining the
View
One of the following
DataMode
A member of the AcOpenDataMode enumeration for stored procedures opened in acNormal view. Possible values are acAdd, acEdit (the default), and acReadOnly.
The OpenStoredProcedure method was first introduced in Access 2000.
Opens a table in the current database.
DoCmd.OpenTable TableName [, View ][, DataMode ]
with the following parameters:
TableName
A String indicating the
View
One of the following
DataMode
A member of the AcOpenDataMode enumeration for tables opened in acNormal view. Possible values are acAdd, acEdit (the default), and acReadOnly.
The example code iterates the AllTables collection, opens each nonsystem table, prints its structure, and then
Public Sub PrintTableStructures() Dim tbl As Variant For Each tbl In CurrentData.AllTables If InStr(1, tbl.Name, "MSys", vbBinaryCompare) = 0 Then DoCmd.OpenTable tbl.Name, acViewDesign If MsgBox("Print table structure?", _ vbQuestion Or vbYesNoCancel, _ "Print Table Structure") = vbYes Then DoCmd.PrintOut acPrintAll End If DoCmd.Close acTable, tbl.Name, acSaveNo End If Next End Sub
You can iterate the tables in the current database by using the CurrentData.AllTables collection. It includes system tables whose
Opens a view in an Access Data Project.
DoCmd.OpenView ViewName [, View ][, DataMode ]
with the following parameters:
ViewName
A string indicating the
View
An AcView constant indicating in which view the ADP view will open. Possible values are acViewDesign (design view), acViewNormal (datasheet view, the default), and acViewPreview (print preview).
DataMode
An AcOpenDataMode constant defining the data entry mode for views opened in acNormal view. Possible values are acAdd, acEdit (the default), and acReadOnly.
The OpenView method was first introduced in Access 2000.
Exports a database object in a variety of formats.
DoCmd.OutputTo ObjectType[, ObjectName][, OutputFormat][, OutputFile][, AutoStart][, TemplateFile][, Encoding]
with the following parameters:
ObjectType
An AcOutputObjectType constant indicating the type of object to export. Possible values are acOutputForm (a form object), acOutputFunction (a SQL Server
ObjectName
The
OutputFormat
An AcFormat constant indicating the export format. Possible values are acFormatASP (Active Server Page), acFormatHTML (HTML file), acFormatIIS (IIS .htx or .idc file), acFormatRTF (RTF file for Word or other word processors), acFormatTXT (plain text file), and acFormatXLS (Excel workbook file).
OutputFile
The
AutoStart
A Boolean that determines whether the application that handles
OutputFile
should
TemplateFile
{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}The path and filename of a file to serve as a template for exported ASP, HTML, and IIS .htx files.
Encoding
A Boolean indicating whether the export file is to be encoded.
The following code exports the customer table in each of the supported formats except XML:
Public Sub ExportTable() DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatASP, _ "C:\BegVBA\Customer.asp" DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatHTML, _ "C:\BegVBA\Customer.html" DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatIIS, _ "C:\BegVBA\Customer.htx" DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatRTF, _ "C:\BegVBA\Customer.rtf" DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatTXT, _ "C:\BegVBA\Customer.txt" DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatXLS, _ "C:\BegVBA\Customer.xls" End Sub
The acOutputDataAccessPage constant is documented but not supported as a value of the OutputFormat argument.
The acFormatDAP and acFormatSNP constants are documented but not supported by the DoCmd method.
You can generate an XML file (possibly along with an XSD file) by omitting the OutputFormat argument and selecting XML from the Output To dialog box. (XML does not have an intrinsic constant in Access 2003.)
If the OutputFormat and OutputFile arguments are omitted, Access prompts for the export file type and export filename, respectively.
In the case of ASP and IIS files,
OutputFile
seems to require a file extension;
If AutoStart is True, the application launched to handle the exported file is defined by the system registry.
The AutoStart argument is ignored for IIS and ASP files.
Generally, the exported files appear to be much more robust than in some previous versions of Access. I was unable to get IIS .htx/.idc files to work at all, and ASP pages required minor tweaking (an ADO connection string had to be added to the call to the Connection object’s Open method), but all remaining exported files accurately reflected the Access data and did not require modification.
Except for an ASP page, which uses ADO to retrieve live data from the database, all exported files contain static data; they provide a snapshot of the data at a given point in time.