J
John T Ingato
How do I call a saved append query from VBA module. I tried using
docmd.runsql() and hand typing in the code but I am getting error. The saved
query in the database (qryPreImport)works fine.
Here is the code in the module with the SQL hard coded, which fails. Error
states: "Query input must contain one table or query". I actually cut and
pasted this code directly from the query in SQL view. As I said, the saved
query works fine.
tblHDStoreList is a local table in the database StoreNumber is a fiels in
this table
PreImport852Report is a linked table to an excel spreadsheet on my computer.
DoCmd.RunSQL ( _
"INSERT INTO tblHDStoreList (StoreNumber )" & _
"SELECT DISTINCT PreImport852Report.StoreNumber AS Expr1" & _
"FROM PreImport852Report LEFT JOIN tblHDStoreList ON
PreImport852Report.StoreNumber = tblHDStoreList.StoreNumber" & _
"WHERE (((tblHDStoreList.StoreNumber) Is Null));")
docmd.runsql() and hand typing in the code but I am getting error. The saved
query in the database (qryPreImport)works fine.
Here is the code in the module with the SQL hard coded, which fails. Error
states: "Query input must contain one table or query". I actually cut and
pasted this code directly from the query in SQL view. As I said, the saved
query works fine.
tblHDStoreList is a local table in the database StoreNumber is a fiels in
this table
PreImport852Report is a linked table to an excel spreadsheet on my computer.
DoCmd.RunSQL ( _
"INSERT INTO tblHDStoreList (StoreNumber )" & _
"SELECT DISTINCT PreImport852Report.StoreNumber AS Expr1" & _
"FROM PreImport852Report LEFT JOIN tblHDStoreList ON
PreImport852Report.StoreNumber = tblHDStoreList.StoreNumber" & _
"WHERE (((tblHDStoreList.StoreNumber) Is Null));")