Hi Guys,
I have a user form with 2 textboxes. the first is to enter a 5 digit site code and the second is for the sitename. What i am trying to do is in the afterupdate of the first textbox in VBA is do a DLookup to pull through the site name from the sites table and populate the second textbox.
My textboxes are named
1st textbox = nscode
2nd textbox = nsitename
my DLookup looks like this.
Now it appears to kind of work but its not looking at the criteria and its just pulling through a random site name rather that the one i want.
Any help would be greatly appreciated.
Si
I have a user form with 2 textboxes. the first is to enter a 5 digit site code and the second is for the sitename. What i am trying to do is in the afterupdate of the first textbox in VBA is do a DLookup to pull through the site name from the sites table and populate the second textbox.
My textboxes are named
1st textbox = nscode
2nd textbox = nsitename
my DLookup looks like this.
Code:
Me.nsitename.Value = DLookup("[Site Name]", "Sites", [SiteCode] = Me.nscode)
Any help would be greatly appreciated.
Si