Open a query.
Syntax
DoCmd.OpenQuery(QueryName, View, DataMode)
Key
QueryName The name of the query to open.
View An AcView constant that specifies the view
in which the query will open. Default=acViewNormal
DataMode An AcOpenDataMode constant that specifies the
data entry mode for the query.
The default value is acEdit.
Use OpenQuery to open a select or crosstab query in Datasheet view, Design view, or Print Preview.
This action will run an action query.
Examples
Open qryDemo and enable the user to view but not to edit or add records:
DoCmd.OpenQuery "qryDemo", , acReadOnly
“I get all the news I need from the weather report” ~ Paul Simon
Related:
OpenReport - Open a report
OpenForm - Open a form.