DLookup

  • Thread starter Thread starter Jeffmklein
  • Start date Start date
J

Jeffmklein

I am trying to create a check in my form that looks for any duplicate client
names. I am using the below code to return the ClientID value if a record
is found.

DLookup("[ClientID]", "[Clients]", "[ClientLastName] =
Form.[ClientLastName]")

This works OK but I have seperate fields for the ClientFirstName and
ClientLastName
So I try:
DLookup("[ClientID]", "[Clients]", "[ClientLastName]&[ClientFirstName] =
Form.[ClientLastName]&[ClientFirstName]")
This is not working. I think DLookup does not like combining the lookup
fields.

Any suggestions on a solution???
 
DLookup("[ClientID]", "Clients", "[ClientLastName] = '" & [ClientLastName] &
"' And [ClientFirstName] = '" & [ClientFirstName] & "'")

the syntax may change slightly depending on exactly where you're using this
expression (macro condition, VBA code, etc.).

hth
 
Tina,
Thanks for the reply. This seems to work great. Thank you very much
Jeff

tina said:
DLookup("[ClientID]", "Clients", "[ClientLastName] = '" & [ClientLastName] &
"' And [ClientFirstName] = '" & [ClientFirstName] & "'")

the syntax may change slightly depending on exactly where you're using this
expression (macro condition, VBA code, etc.).

hth


Jeffmklein said:
I am trying to create a check in my form that looks for any duplicate client
names. I am using the below code to return the ClientID value if a record
is found.

DLookup("[ClientID]", "[Clients]", "[ClientLastName] =
Form.[ClientLastName]")

This works OK but I have seperate fields for the ClientFirstName and
ClientLastName
So I try:
DLookup("[ClientID]", "[Clients]", "[ClientLastName]&[ClientFirstName] =
Form.[ClientLastName]&[ClientFirstName]")
This is not working. I think DLookup does not like combining the lookup
fields.

Any suggestions on a solution???
 
you're welcome :)


JeffMKlein said:
Tina,
Thanks for the reply. This seems to work great. Thank you very much
Jeff

tina said:
DLookup("[ClientID]", "Clients", "[ClientLastName] = '" &
[ClientLastName]
&
"' And [ClientFirstName] = '" & [ClientFirstName] & "'")

the syntax may change slightly depending on exactly where you're using this
expression (macro condition, VBA code, etc.).

hth


Jeffmklein said:
I am trying to create a check in my form that looks for any duplicate client
names. I am using the below code to return the ClientID value if a record
is found.

DLookup("[ClientID]", "[Clients]", "[ClientLastName] =
Form.[ClientLastName]")

This works OK but I have seperate fields for the ClientFirstName and
ClientLastName
So I try:
DLookup("[ClientID]", "[Clients]", "[ClientLastName]&[ClientFirstName] =
Form.[ClientLastName]&[ClientFirstName]")
This is not working. I think DLookup does not like combining the lookup
fields.

Any suggestions on a solution???
 
Back
Top