OpenQueryDef Method Example

This example provides a value for the State Wanted parameter of an existing query named Get State and creates a Snapshot of the records for all publishers in New York.

Dim MyDB As Database, MyQuery As QueryDef, MySet As Snapshot
Set MyDB = OpenDatabase("BIBLIO.MDB")
Set MyQuery = MyDB.OpenQueryDef("Get State")  ' Open QueryDef.
MyQuery![State Wanted] = "NY"                 ' Set parameter.
Set MySet = MyQuery.CreateSnapshot()          ' Create Snapshot.
...