In MS Access VBA, how can I call a saved append request with parameters?

In my Access 2007 database, I have an append request with parameters in it. How can I call this request from a VBA script?

I understand that I could just generate the query text on the fly in VBA code, but this is much more inconvenient.

+3
source share
1 answer

I got the following:

Dim db As DAO.Database
Dim qry As DAO.QueryDef

Set db = CurrentDb

Set qry= db.QueryDefs("NameOfMyStoredQuery")

qry.Parameters(0) = FirstParamValue
qry.Parameters(1) = SecondParamValue
qry.Parameters(2) = ThirdParamValue

qry.Execute
+8
source

All Articles