Problems using the DCount Function

G

GaryC

Could someone please help me with the syntax of a DCount function I'm using:-

I get a run-time error 3075 Syntax error(missing operator) in query
expression

If DCount(1, "DS_CHASSIS", "ACBOXSerialNumber2 = " & Me!_
ACBOXSerialNumber1) > 0 Then
Cancel = True
MsgBox ("Duplicate Value")

ElseIf DCount(1, "DS_CHASSIS", "ACBOXSerialNumber1 = " & Me!_
ACBOXSerialNumber2) > 0 Then
Cancel = True
MsgBox ("Duplicate Value")

End If

Thanks
 
D

doodle

Try:


If DCount(1, "DS_CHASSIS", "[ACBOXSerialNumber2]=" & "'" & _
Me![ACBOXSerialNumber1] & "'") > 0 Then
Cancel = True
MsgBox ("Duplicate Value")
End If

If DCount(1, "DS_CHASSIS", "[ACBOXSerialNumber1]=" & "'" & _
Me![ACBOXSerialNumber2] & "'") > 0 Then
Cancel = True
MsgBox ("Duplicate Value")
End If

-doodle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top