Text box linked to combo box

MrMitch

Registered User.
Local time
Yesterday, 18:26
Joined
Oct 19, 2007
Messages
50
I have a form that has a combo box I wish the user to select a "site" from. I would then want a seperate text box to populate with the project manager for that site, which is in the "Sites" table as "PM". I am just unsure of the code to write on the "After Update" of the Site combo box to get this to work. Any help would be appricated. Thanks!
 
See if a dlookup() function would work...
 
I would include that data in the row source of the combo. You can then get it with the column property. In VBA:

Me.ComboName.Column(1)

Note that the column property is zero based.
 
Code:
Private Sub Site_Form_Click()
Dim selection as string


selection = comboBox.Value
textBox = DLookup("PM", "site_table", "[site]=" & selection))

end sub

I think that would work
 
I think I like Pauls suggestion better - :)
 

Users who are viewing this thread

Back
Top Bottom