I've been racking my brains over this for the better part of today. For the live of me I cannot get to the bottom of this.
I have a sub called Export. For the file naming, I must pull information from tables. The code below is a small part of the function, but it continues to return a blank query.
Sub Export(tableexportname As String)
MsgBox tableexportname
SQLlowgrade = "SELECT [" & tableexportname & "].* INTO [templow] FROM [" & tableexportname & "];"
MsgBox SQLlowgrade
SQLhighgrade = "SELECT [" & tableexportname & "].* INTO [temphigh] FROM [" & tableexportname & "];"
MsgBox SQLhighgrade
CurrentDb.Execute SQLlowgrade
CurrentDb.Execute SQLhighgrade
End Sub
Call Export ("Running_Import_LA")
MsgBox tableexportname gives me, exactly, Running_Import_LA so the variable is passing into the sub.
MsgBox SQLlowgrade gives me, exactly, SELECT [Running_Import_LA.* INTO [templow] FROM [Running_Import_LA];
This is a good query as I have tested it in the Query design and it does indeed return the full table [Running_Import_LA] into a newly created table [templow].
The same goes for MsgBox SQLhighgrade.
When I run the vba code, the query in CurrentDB.Execute returns an empty table for [templow]. I'm so stuck at this point.
Can someone please help?
I have a sub called Export. For the file naming, I must pull information from tables. The code below is a small part of the function, but it continues to return a blank query.
Sub Export(tableexportname As String)
MsgBox tableexportname
SQLlowgrade = "SELECT [" & tableexportname & "].* INTO [templow] FROM [" & tableexportname & "];"
MsgBox SQLlowgrade
SQLhighgrade = "SELECT [" & tableexportname & "].* INTO [temphigh] FROM [" & tableexportname & "];"
MsgBox SQLhighgrade
CurrentDb.Execute SQLlowgrade
CurrentDb.Execute SQLhighgrade
End Sub
Call Export ("Running_Import_LA")
MsgBox tableexportname gives me, exactly, Running_Import_LA so the variable is passing into the sub.
MsgBox SQLlowgrade gives me, exactly, SELECT [Running_Import_LA.* INTO [templow] FROM [Running_Import_LA];
This is a good query as I have tested it in the Query design and it does indeed return the full table [Running_Import_LA] into a newly created table [templow].
The same goes for MsgBox SQLhighgrade.
When I run the vba code, the query in CurrentDB.Execute returns an empty table for [templow]. I'm so stuck at this point.
Can someone please help?