View Single Post
  #6 (permalink)  
Old February 21st, 2008, 09:39 AM
SerranoG SerranoG is offline
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Hi, David. Welcome to P2P. Here are two ways to tackle this.

1) Mike is correct that you can populate the combobox with field1 and field2 from the table. You can hide the second column of the combobox (or not). In the combobox's AfterUpdate event, you'd have.

Me.TextBox = Me.ComboBox.Column(1)

This assumes the first column (i.e. Column(0)) has the visible dropdown values, and the second column (i.e. Column(1)) has the desired values.

2) If you have only one column in the dropdown, then you can get the same effect this way.

Me.TextBox = DLookUp("[Field2]", "MyTable", "[Field1] = '" & Me.ComboBox & "'")

I'm using fake names for everything. Substitute your real ones.



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote