ListParameters Method Example

The example creates a Snapshot with the ListParameters method, then prints the field names and values in the Debug window.  To run the example, paste the code over the Form_Click event procedure code and press F5 to run your program.  Click the form to run the procedure.

Sub Form_Click ()
  Dim Db As Database, Qd As QueryDef, Sn As Snapshot, I As Integer
  Set Db = OpenDatabase("BIBLIO.MDB")    ' Open a database.
  Set Qd = Db.OpenQueryDef("Get State")  ' Open a QueryDef.
  Set Sn = Qd.ListParameters()           ' Get parameters of query.
  Debug.Print "Name", "Type"             ' Print column heads.
  Do While Not Sn.EOF                    ' Print each value.
    Debug.Print Sn("Name"),
    Debug.Print Sn("Type")
    Sn.MoveNext                          ' Move to next record.
End Sub