Check if client name exists in table

Barbados

Registered User.
Local time
Today, 21:01
Joined
May 22, 2013
Messages
27
Hi,

Using VBA (in Access), what code should I use to check if a client name already exists in a table.

Say, client name is "Smith", my table is called tblClient and the field name in the table is called fldClientName.

I just need to do the check, that's all.

Thanks.
 
You can use DCount.. Something along the lines of..
Code:
Dim countVal As Long
countVal = DCount("*", "tblClient", "fldClientName = 'Smith'")
If the countVal is >0 means there is a Customer with name Smith..
 
You can use DCount.. Something along the lines of..
Code:
Dim countVal As Long
countVal = DCount("*", "tblClient", "fldClientName = 'Smith'")
If the countVal is >0 means there is a Customer with name Smith..

Works great. Thanks!
 

Users who are viewing this thread

Back
Top Bottom