Home  Fees/Services  Access Examples  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

DoCmd Examples - Access VBA
Open Query DoCmd

Docmd Macro VB Examples Macro DoCmd Functions

Database Tutorials>DoCmd Examples>DoCmd OpenQuery

Download Access Database >



DoCmd AddMenu
DoCmd ApplyFilter
DoCmd CancelEvent
DoCmd Close
DoCmd CopyObject
DoCmd DeleteObject
DoCmd FindRecord
DoCmd FindNext
DoCmd GotoControl
DoCmd HourGlass
DoCmd Min/Max/Restore
DoCmd OpenForm
DoCmd OpenQuery
DoCmd OpenReport
DoCmd OutputTo
DoCmd RunSQL
DoCmd SendObject
DoCmd TransferDatabase
DoCmd TransferText

Create Export Specs




OpenQuery Method Example

The OpenQuery method opens a select or crosstab query in Datasheet view, Design view, or Print Preview - or runs an action query from visual basic.

OpenQuery
(command line continued below)
Openquery DoCmd Example


The QueryName is the only required argument in the openquery statement and is the name of a saved query definition.

View - is the view mode and can have one of the following values:

acViewDesign
acViewNormal     (default viewmode)
acViewPivotChart
acViewPivotTable
acViewPreview

DataMode - which has the following options:

acAdd
acEdit default
acReadOnly

When running an action OpenQuery you normally only specify the name of the query:

DoCmd.OpenQuery "Q_Update_Due_Date"

More OpenQuery examples:
 

Visual Basic Select Case with OpenQuery Example

DoCmd.OpenReport stDocName, acPreview Case 2 DoCmd.OpenQuery "Q_Daily_Prospect_Labels" Case 3 Set db = CurrentDb pitney = DLookup("Path", "Q_path_Pitney",





Contact Information

Custom Software Developers
MS Access 2003 2000 2002(XP) 97 All Windows Versions