Solved What is wrong in the given code

sbaud2003

Member
Local time
Today, 08:52
Joined
Apr 5, 2020
Messages
186
Me.TALLOT.value = DSum("allotment", "allotment", "[UNIT_CODE] = '" & [COMSC] & "' AND [CODE_HEAD] ='" & [COMSNG] & "' AND and [finyear] = " & [COMFY])))

UNIT_CODE is a text field
CODE_HEAD is a text field
finyear is numeric field
i am geeting error 3075
 
And what is error 3075?

What type is COMFY ?

Put all the criteria into a string and Debug.Print the string

You have two ANDs ?
 
you have too many closing ) parenthesis:

..[COMFY])))
 
And what is error 3075?

What type is COMFY ?

Put all the criteria into a string and Debug.Print the string

You have two ANDs ?
3075 is syntax error
COMFY IS COMBO BOX CONTAINS YEAR
I NEED TO FILTER OUT WITH THREE CRITERIA THAT'S WHY TWO--- AND
 
Me.TALLOT.value = DSum("allotment", "allotment", "[UNIT_CODE] = '" & [COMSC] & "' AND [CODE_HEAD] ='" & [COMSNG] & "' AND and [finyear] = " & [COMFY])))

UNIT_CODE is a text field
CODE_HEAD is a text field
finyear is numeric field
i am geeting error 3075
When I said two and I meant those highlighted :-)
 
When I said two and I meant those highlighted :)
I didn't understand what you meant by 2 ANDs. I was thinking about 2 separate ANDs and what may be wrong with it.
 
Last edited:
Just to be sure, in addition to the other comments, are you trying to get the sum of a field called 'allotment' in a table/query also called 'allotment'?
 

Users who are viewing this thread

Back
Top Bottom