Hi
In a form, I want to autopopulate two fields of contact details after the user selects a contact name from the another field using a lookup query. For example, the user selects the contact name in field A. Using the afterUpdate feature of this field I want to automatically populate two other fields (phone number, email address).
The query looks like this:-
And my current vba code looks like this:-
The phone number works fine but for some reason the email will not work. Can someone help me fix this or advise on easier way to achieve my goal. Help is greatly appreciated, thanks.
In a form, I want to autopopulate two fields of contact details after the user selects a contact name from the another field using a lookup query. For example, the user selects the contact name in field A. Using the afterUpdate feature of this field I want to automatically populate two other fields (phone number, email address).
The query looks like this:-
Code:
SELECT CSContactDetails.CSContactName, CSContactDetails.CSContactNumber, CSContactDetails.CSContactEmail
FROM CSContactDetails
ORDER BY CSContactDetails.CSContactName;
And my current vba code looks like this:-
Code:
Private Sub CSContactName_AfterUpdate()
Me!CSContactNumber = Me![CSContactName].Column(1)
Me!CSContactEmail = Me![CSContactName].Column(2)
End Sub
The phone number works fine but for some reason the email will not work. Can someone help me fix this or advise on easier way to achieve my goal. Help is greatly appreciated, thanks.