Hi, I'm trying to get the following SQL code to run in VBA, but I'm receiving an error message stating "Query Input must contain at least one table or query"
Neither variable "'" & crntCBSUnbilledCycle & "'" nor " '" & strBusUnit & "' " seems to be getting passed through and the latter variable is actually showing up as green in the VBA window.
Here is the Debug.Print, should it help:
INSERT INTO tblUnbilled_PreCutoff_Counts ( LOB, [Import PreCutoff Count] ) SELECT impUnbilled_PreCutoff_Temp.LOB, Count(impUnbilled_PreCutoff_Temp.[CBS Id])AS [CountOfCBS Id] ''FROM impUnbilled_PreCutoff_Temp GROUP BY impUnbilled_PreCutoff_Temp.LOB Where ((impUnbilled_PreCutoff_Temp.LOB) =
As an aside, the variable " & "'" & crntCBSUnbilledCycle & "'" is being used successfully in other SQL statements.
Code:
mySQL = "INSERT INTO tblUnbilled_PreCutoff_Counts ( LOB, [Import PreCutoff Count] ) " & _
"SELECT impUnbilled_PreCutoff_Temp.LOB, Count(impUnbilled_PreCutoff_Temp.[CBS Id])" & _
"AS [CountOfCBS Id] " & "'" & crntCBSUnbilledCycle & "'" & _
"FROM impUnbilled_PreCutoff_Temp " & _
"GROUP BY impUnbilled_PreCutoff_Temp.LOB" & _
" Where ((impUnbilled_PreCutoff_Temp.LOB) = [COLOR=seagreen]" '" & strBusUnit & "' "[/COLOR]);"
Neither variable "'" & crntCBSUnbilledCycle & "'" nor " '" & strBusUnit & "' " seems to be getting passed through and the latter variable is actually showing up as green in the VBA window.
Here is the Debug.Print, should it help:
INSERT INTO tblUnbilled_PreCutoff_Counts ( LOB, [Import PreCutoff Count] ) SELECT impUnbilled_PreCutoff_Temp.LOB, Count(impUnbilled_PreCutoff_Temp.[CBS Id])AS [CountOfCBS Id] ''FROM impUnbilled_PreCutoff_Temp GROUP BY impUnbilled_PreCutoff_Temp.LOB Where ((impUnbilled_PreCutoff_Temp.LOB) =
As an aside, the variable " & "'" & crntCBSUnbilledCycle & "'" is being used successfully in other SQL statements.