I'm opening an ADODB connection using a small function (this works fine) and I'm trying to pass a parameter into a Make Table Query. and getting an error that reads: 'an action query can not be used as a row source'
Here is the code that I'm testing.
Conn.Execute (sql)
With cmd
.ActiveConnection = Conn
.CommandType = adCmdText
.CommandText = "SELECT * FROM c1GetLIVEDBnTF WHERE [AS OF DATE] = ?"
End With
cmd.Parameters.Append cmd.CreateParameter("[AS OF DATE]", adInteger, adParamInput, 10)
cmd.Parameters(0).Value = Range("ASOFDATE").Value
Set rs = cmd.Execute
I'm trying to pass a date from Range("ASOFDATE").Value (Excel worksheet) into an Access Make Table Query.
I found the example below, but couldn't get to to work.
Conn.Execute (sql)doing? Where are you getting the error?adIntegertype, or is it anadDatetype? (That's probably not causing your error though.)SELECTfrom a Make Table query. You have to make the table, then select from the table you made. (Or change the make table query to just be a select query.) P.S. I don't know enough ADODB to write an answer without a lot of testing, so someone else can feel free to post a proper answer.