dsum problem

mmiraj

New member
Local time
Today, 09:10
Joined
Apr 16, 2002
Messages
5
i use DSum to calculate subtotal Telephone service. By putting GuestID, it will be showed subtotal of telephone service
everything works fine. the problem is when data is empty, it is showing error mesage " runtime error 3075
syntax error (missing operator query in query expression "[GuestID]="


Here is my Dsum

Dim subtotal As Currency
subtotal = DSum("[TotalBiayaTelephone]", "Telephone_Service_record", "[GuestID] = " & Me.GuestID & "")
If Not IsNull(subtotal) Then Me!subtotal1 = subtotal

End Sub
 
If GuestID is a number, replace the DSum code with

subtotal = DSum("[TotalBiayaTelephone]", "Telephone_Service_record", "[GuestID] = " & Me.GuestID)

To filter out a Null ID then

Dim subtotal As Currency
If Not IsNull(Me.GuestID) Then
subtotal = DSum("[TotalBiayaTelephone]", "Telephone_Service_record", "[GuestID] = " & Me.GuestID & "")' remove & "" if GuestID is numerical
Me.subtotal1 = subtotal
Else Me.subtotal1 = 0
End If

HTH
 

Users who are viewing this thread

Back
Top Bottom