Hello everyone,
I use the following code to run an action query in VBA:
It works fine for simple action queries.
However, when I run a complex query based on 2 parameterized select-queries (all parameteres have the same name [prmDate]) the code doesn't work. It doesn't give me any error message either.
When I execute the same action query in Database Window (manually) it works fine.
Does anybody know how the parameters should be specified to run a complex action query based on a few parameterized select-queries?
Thanks.
surotkin
I use the following code to run an action query in VBA:
Code:
Dim cmd_ADO As ADODB.Command
Dim prm_ADO As ADODB.Parameter
Set cmd_ADO = New ADODB.Command
Set cmd_ADO.ActiveConnection = CurrentProject.Connection
cmd_ADO.CommandType = adCmdStoredProc
cmd_ADO.CommandText = "MyActionQuery"
Set prm_ADO = cmd_ADO.CreateParameter("[prmDate]", adDate, adParamInput)
cmd_ADO.Parameters.Append prm_ADO
prm_ADO.Value = cdate("01/01/2006")
cmd_ADO.Execute Options:=adExecuteNoRecords
It works fine for simple action queries.
However, when I run a complex query based on 2 parameterized select-queries (all parameteres have the same name [prmDate]) the code doesn't work. It doesn't give me any error message either.
When I execute the same action query in Database Window (manually) it works fine.
Does anybody know how the parameters should be specified to run a complex action query based on a few parameterized select-queries?
Thanks.
surotkin