I've got a strange situation I've never encountered. I have to execute a series of Insert Into query statements. I have the parameters that I need in table. I loop through the table and execute the following statement:
db.Execute "Insert Into tblAllocVGrossTotalsPerCheck (PayHistoryID,TotalAmount, QryName, Category) " & _
"Select " & !qryPrimaryKey & ", " & !QryTotalFld & ", '" & !QryName & "' As QueryName, '" & !Category & "' As Category From " & !QryName & " Order By " & !qryPrimaryKey
As you can see many of the values that I need are fields from a table. But with some of the records I'm getting...
Too few Parameters, Expected 1.
Here's where it gets really strange. In the immediate window, I get the result of the full string expression I'm trying to execute, then copy and paste the exact text into the query designer, IN ACTUAL TIME, and the query executes without a problem. It gets stranger when you consider that some of the records in the loop go through without any problem. I keep trying to compare the ones that have no problem to the ones that do, but I'm not seeing anything different.
I'm lost. Anyone have any clues what might be going on?
Any ideas where to look would be greatly appreciated.