I have received great help here previously now i need some more.
I've tried manipulating my code in always but cant solve my current issue.
My 3 tables are Clientdetails, Clientcontact and Clientdoctor.
All the lookups below work fine.
clientname is a textbox i use to search the Database and populate my form unbound. i want to populate other textboxes with data from Clientcontact table as well. I'm using a command button relevant to the clientname search. Any help please.
D = DLookup("[ID]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Forename = DLookup("[Forename]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Surname = DLookup("[Surname]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address1 = DLookup("[Address1]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address2 = DLookup("[Address2]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address3 = DLookup("[Address3]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Phonenumber = DLookup("[Phonenumber]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
attending = DLookup("[Daysattending]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
ClientImage.Picture = DLookup("[ClientPicture]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Below are dlookups for the other textboxes i want to populate, I dont know what to do here.
fore = DLookup("[Forename]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
surn = DLookup("[Surnames]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
rela = DLookup("[Relationship]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
tele = DLookup("[Hometelephone]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
mobi = DLookup("[Mobile]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
'surn = DLookup("[Surnames]", "[Clientcontacts]", "[Surnames]='" & [Forms]![unboundfrm]![surn] & "'")
Cheers
Gus-G
I've tried manipulating my code in always but cant solve my current issue.
My 3 tables are Clientdetails, Clientcontact and Clientdoctor.
All the lookups below work fine.
clientname is a textbox i use to search the Database and populate my form unbound. i want to populate other textboxes with data from Clientcontact table as well. I'm using a command button relevant to the clientname search. Any help please.
Forename = DLookup("[Forename]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Surname = DLookup("[Surname]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address1 = DLookup("[Address1]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address2 = DLookup("[Address2]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address3 = DLookup("[Address3]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Phonenumber = DLookup("[Phonenumber]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
attending = DLookup("[Daysattending]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
ClientImage.Picture = DLookup("[ClientPicture]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Below are dlookups for the other textboxes i want to populate, I dont know what to do here.
fore = DLookup("[Forename]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
surn = DLookup("[Surnames]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
rela = DLookup("[Relationship]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
tele = DLookup("[Hometelephone]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
mobi = DLookup("[Mobile]", "[Clientcontacts]", "[Surnames] ='" & [Forms]![unboundfrm]![clientname] & "'")
'surn = DLookup("[Surnames]", "[Clientcontacts]", "[Surnames]='" & [Forms]![unboundfrm]![surn] & "'")
Cheers
Gus-G