Default value based on corresponding value selected from list box

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
 
J

Jack

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)
 
P

Phil Roy

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top