Are my errors in the right order?

Valentine

Member
Local time
Today, 05:40
Joined
Oct 1, 2021
Messages
261
I just got an error with missing operator. So I found I was missing single quotes around a variable and now im getting error too few parameters. Am I going in the right direction or did I make it worse?
 
Who can tell? without seeing the code?:(
The experts here are good, but not mind readers or psychic.
 
Yes
 
If by adding the missing quotes you fixed the original error and discovered the next one, then yes. However, if by adding the missing quotes you actually compounded the issue and introduced a new problem, then no.
 
Code:
strCat = "SELECT FulfillmentGroup.[Fulfillment Group] FROM FulfillmentGroup " _
       & "WHERE ((FulfillmentGroup.[Fulfillment Group]) Not like 'Rejected' and (FulfillmentGroup.[Fulfillment Group] not like 'Delivered'))"
Set rsCDGRCat = dbCurr.OpenRecordset(strCat)       
strCDGR = "SELECT CnfToCdgr.[CDGR ID#], CnfToThreat.[Threat Adversary], FulfillmentGroup.[Fulfillment Group]" _
       & "FROM (CdgrToCidr INNER JOIN FulfillmentGroup ON CdgrToCidr.[Fulfillment Status] = FulfillmentGroup.[Fulfillment Group])" _
       & "ON CnfToThreat.[CNF ID#] = Cnf.[CNF ID#]) ON CdgrToCidr.[CDGR ID#] = CnfToCdgr.[CDGR ID#] " _
       & "WHERE ((" & whereStr & ") AND ((FulfillmentGroup.[Fulfillment Group]) = '" & rsCDGRCat![Fulfillment Group] & "'));"

This is how the code looks and i get the "Too Few Parameters" once I put the " & whereStr & " into single quotes I get the missing operator. So I just put CnfToThreat.[Threat Adversary] = 'VEO' instead of that variable I got no errors. The str that that variable is apart of works flawlessly by itself.
 
Have you thought about using debug.print to see what you actually have, not what you think you have?
 
I am concerned about this statement
once I put the " & whereStr & " into single quotes
To my knowledge no single quotes would or should be needed?
 
Building the string is the first step to debugging. Put a breakpoint on the line AFTER the code that populates the variable. Then print strCDGR to the debug window. If you can't see the error, We'll look at it. Also, you can open the QBE and switch to SQL view and paste the string there. Try to run the query. You may get a better error message.

BUT, usually when Access complains about missing arguments, it is because you have a typo in some field/table/query name.

In my opinion, building queries using embedded SQL is far more cumbersome than using the QBE but that's my opinion.
 

Users who are viewing this thread

Back
Top Bottom