New Field in form question

A

Antavas

I have a form that has a state field. I have to add a region field to the
form that must autopopulate based on the State selected from a drop down box.
Since the state field already exsists how do I do this?
 
J

Jeff Boyce

If the [Region] is automatically determined by knowing [State], you don't
really need to (redundantly) store [Region], right?

If you have a lookup table of State Region, you could use the query that
feeds the State drop-down on your form to also return the [Region] for that
state.

Then you could add something like the following to the AfterUpdate event of
the State drop-down:

Me!txtRegion = Me!cboState.Column(1)

where .Column() is a zero-based list of the columns in the query feeding the
combobox (drop-down).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jeanette Cunningham

Antavas,
DLookup is your friend here.

On the after update event of the state combo, use DLookup to get the region
name from the appropriate query.
To get help on DLookup, type DLookup in the immediate window, put cursor in
the word and press F1.
You set the value of the text box for Region to the value you get from
DLookup.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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