Sep 6 2006, 09:50 AM
Hi. I have an SQL statement that appends records to a table:
SQL1 = "INSERT INTO [TBLTEMP_LOCHEAD]" & _
"SELECT LOCATION_HEADER2.*" & _
"FROM [LOCATION_HEADER2]" & _
Whereclause & _
"ORDER BY [TWP], [TDIR], [RNG], [RDIR], [SECTION]"
After this runs I get a popup box asking if I want to append these records. Is there a way to automatically append the records using vba code without having the popup box. Thank you.
Sep 6 2006, 09:51 AM
instead of using the RunSQL method try to execute your code with the .execute method e.g.:
CurrentDb.Execute "YourSQL", dbFailOnError
Sep 6 2006, 10:02 AM
I dont think that works. It says it is unable to find the input table or query 'SQL1'. Thank you though.
Sep 6 2006, 10:10 AM
Remove the quotes. If you are passing in a variable as the SQL, you don't want to wrap the variable in quotes. VBA will think it is a literal.
Sep 6 2006, 10:50 AM
Cool. Thanks. That worked. Another quick question. When its running, the form kinda freezes until it is done. It doesnt give any indication that the SQL is running. Is there a way to make the cursor turn into the time capsule while its running? Thanks.
Sep 6 2006, 10:51 AM
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here