Help! what is wrong with this code

rbarrett

New member
Local time
Today, 23:14
Joined
Jun 18, 2001
Messages
8
This is giving me a syntax error of "Missing Operand" I have tryed putting an = sign inside the ( out side the ( removing the outer() and using a varible all come back with various syntax errors.

this is on an access report
<code>
Private Sub Report_Activate()
Do Until (DSum("Gallons Received", "qryDGLRPT", "product code=product code")) <= (Forms![frmDGLRPT]![GALLONS1])
Loop
End Sub
</code>
 
You need brackets([]) around the Field names. Also, if product code is a string, then use tick marks(') like the example below.

Do Until (DSum("[Gallons Received]", "qryDGLRPT", "[product code]='product code'"))

'Otherwise you can leave them out.

Do Until (DSum("[Gallons Received]", "qryDGLRPT", "[product code]=product code"))
 
D-Fresh is right on about the square brackets. If 'product code' is a variable then you may need to change your code to look like this if the variable is Text:

DSum("[Gallons Received]", "qryDGLRPT", "[product code] = '" & [product code] & "'")

If it is numeric then try this:

DSum("[Gallons Received]", "qryDGLRPT", "[product code] = " & [product code])

[This message has been edited by Jack Cowley (edited 06-29-2001).]
 

Users who are viewing this thread

Back
Top Bottom