Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having problems with DLookup

Status
Not open for further replies.

rew2009

Technical User
Apr 21, 2009
114
US
I am using an Access form that has a text box called – “Me.txtboxOwner_Addr” which displays owner information from a field called “Owner_Addr“ in a MS SQL database table “Apts”. This same record has another field “PRIMARYOWNERRECORD” that is "false". I want to pull out the “ID” number for another record that has the same “Owner_Addr” information but has the field “PRIMARYOWNERRECORD = true”.

I want to put that ID info in a text box called Me.Text196. “ID” is numerical, Owner_address is string, PRIMARYOWNERRECORD is “yes/no”.

I used the following DLookup function but it always returns “ID”= 1 which is not correct. Do I have the syntax wrong?

This is my code:
Me.Text196 = DLookup("ID", "Apts", (Me.txtboxOwner_Addr.VALUE = Owner_Addr) And (PRIMARYOWNERRECORD = True))

Thanks
REW2009
 
Code:
Me!Text196 = DLookUp("ID", "Apts", "Owner_Addr='" & Me!txtboxOwner_Addr & "' AND PRIMARYOWNERRECORD=True")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top