Question DCount problem

byTimber

Registered User.
Local time
Today, 00:14
Joined
Apr 14, 2012
Messages
97
Can anyone help here:

Table is named tblLVR
Field is BusinessName

I want to check the previous existence of this name in the table.

I assign a variable tBusVar to the entered name on it's changed event
and write the following code to see if it is already in:-

If DCount("[BusinessName]", "tblLVR", "[BusinessName] = " & tBusVar) > 0 Then
MsgBox "This current record is a Duplicate"
End If

Run_time Error :'2471':
The expression passed as a query parameter produced this error '<Name entered>'

I can't understand what is happening here. Grateful for any help....
 
Thanks for reply Paul, but tBusVar is a variable and not actual text; how would that play with DCount and DLookup in my situation?
 
It would be the same as the form example, replacing the form reference with your variable.
 
Happy to help Roger!
 

Users who are viewing this thread

Back
Top Bottom