Default value based on corresponding value selected from list box

  • Thread starter Thread starter Lori Mihalko
  • Start date Start date
L

Lori Mihalko

Hello,

I have a field in a table that has a list box lookup
based on a query. In the query, there are 2 columns, A &
B. When I select a value from column A in my field with
the list box lookup, I want the corresponding value from
column B to default into another field in the table.

Example: Field1 in table1 calls for a part#. The part
number is selected from the list, which is calling
query5. In query5, there are 2 columns. Column1 is
equal to field1 when selected from the list. I want
field2 of table1 to have a default value equal to column2
from query5, corresponding to the value that was selected
in field1.

Please assist me with the setup of this default value.

Thanks,
Lori Mihalko
 
Assuming part# is the field bound to the list box(field1)
and is the first column in your query, then the following
code placed in the AfterUpdate event of the list box will
place the value of the second column into field2:
Me![field2] = Me![field1].column(1)
 
I had to do this with a combobox a few months ago, and I
think the solution is the column property... try this for
the listbox's update event:

field2 = mylistbox.column(2)
 
Back
Top