Auto fill

D

Diogo

Ok
I know this most be a recurrent doubt but I couldn't find anything that
would suite my needs.

I have a combo box that a user uses to enter a store name. The next field is
another combo box that the user uses to enter the store code.
How can I make Access auto fill the store code field?
In the row source control of the first combo box I have a select that
selects the store name from a table. This table has the names and the codes
of the stores.
How can I make a query or code that sees the apropriate code in the stores
Table and auto fills the code in the forms second combo box? Based of course
in the name that the user selected in the first combo.
I need this code to update value in case the user dicides to change the
store name in the middle of his filling form.
 
D

Damon Heron

If the store name and code are in the same table, why do you need the user
to have the store code in a combo box?
Why does the user even need to see the store code?

Damon
 
M

Marshall Barton

Diogo said:
I know this most be a recurrent doubt but I couldn't find anything that
would suite my needs.

I have a combo box that a user uses to enter a store name. The next field is
another combo box that the user uses to enter the store code.
How can I make Access auto fill the store code field?
In the row source control of the first combo box I have a select that
selects the store name from a table. This table has the names and the codes
of the stores.
How can I make a query or code that sees the apropriate code in the stores
Table and auto fills the code in the forms second combo box? Based of course
in the name that the user selected in the first combo.
I need this code to update value in case the user dicides to change the
store name in the middle of his filling form.


Since the store name and store code are interrelated you
only need to same the code in the form's record. This
implies that the combo box's row source query should include
both fields:
SELECT storecode, storename FROM table ORDERY BY storename

Then the combo box's BoundColumn should be set to 1 and the
ColumnWidths property could be set so only the store name
appears in the drop down list by using 0;

OTOH, if you want users to see both the code and name, then
you can add a text box next to the combo box and set it's
expression to =combobox.Column(0)
 

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