I already define a querydef called ABCDelete in MS Access mdb which have the following definition.
PARAMETERS [param1] date, [param2] text;
DELETE FROM ......
How can I execute and supply the parameters by means of DAO in VB or VBA?
The following cause runtime error at the CreateQueryDef
- too few parameters, expected ...
If I add something extra more than ABCDelete, the following error occurs
- The database engine cannot find the table, query, ...
Dim myqry as dao.querydef
set myqry = mydb.createquerydef("ABCDelete"
with myqry.parameters
!param1.value = ...
!param2.value = ...
If I ignore the existing QueryDef object in MSAcess and create a temp querydef by repeating the defintion of the querydef as follow, everything works fine.
Dim myqry as dao.querydef
Dim mySQL as string
mySQL = "PARAMETERS [param1] date, [param2] text;" & _
"DELETE FROM ......"
set myqry = mydb.createquerydef(mySQL)
with myqry.parameters
!param1.value = ...
!param2.value = ...
PARAMETERS [param1] date, [param2] text;
DELETE FROM ......
How can I execute and supply the parameters by means of DAO in VB or VBA?
The following cause runtime error at the CreateQueryDef
- too few parameters, expected ...
If I add something extra more than ABCDelete, the following error occurs
- The database engine cannot find the table, query, ...
Dim myqry as dao.querydef
set myqry = mydb.createquerydef("ABCDelete"
with myqry.parameters
!param1.value = ...
!param2.value = ...
If I ignore the existing QueryDef object in MSAcess and create a temp querydef by repeating the defintion of the querydef as follow, everything works fine.
Dim myqry as dao.querydef
Dim mySQL as string
mySQL = "PARAMETERS [param1] date, [param2] text;" & _
"DELETE FROM ......"
set myqry = mydb.createquerydef(mySQL)
with myqry.parameters
!param1.value = ...
!param2.value = ...