OpenQuery


Opens a query in the current database.

Syntax

DoCmd.OpenQuery QueryName[, View][, DataMode]

with the following parameters:

QueryName

A string indicating the name of the query.

View

One of the following members of the AcView enumeration: acViewDesign (design view or SQL view), acViewNormal (open in datasheet view or run an action query), or acViewPreview (print preview). The default is acViewNormal.

DataMode

For queries opened in acViewNormal view, one of the following AcOpenDataMode constants to indicate what the user can do with the query: acAdd, acEdit (the default), or acReadOnly.

Example

See the example for the CopyObject method.

Comments

  • The OpenQuery method only works with queries stored in an Access database (an MDB file). In an Access Data Project (ADP) environment, use the OpenView or OpenStoredProcedure methods.

  • This method is most useful for running update queries. Select queries, on the other hand, are most useful when used with Access forms.




Access VBA Programming
Microsoft Access VBA Programming for the Absolute Beginner
ISBN: 1598633937
EAN: 2147483647
Year: 2006
Pages: 214
Authors: Michael Vine

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net