change a field's value depending of what I choose in another field

F

Fia

Hi
I have a table where I have a field which is a combobox. And when I choose a
value from that combobox I would like another field's value to change. The
to fields are in the same table. I there a way to do that?

Thanks

Fia
 
J

Jeff Boyce

If, as your description suggests, you are trying to do this directly in a
table, STOP NOW!

MS Access tables store data, but don't handle "events" (like the selection
of an item in a field).

MS Access forms display data, and DO handle events like AfterUpdate of a
combobox. Use a form and "cascading comboboxes" in that form.

NOTE: the "lookup datatype" field in an Access table can cause you (and
those who try to use your database) considerable headaches. You've
uncovered just one of the shortcomings of trying to use that lookup/combobox
directly in a table. There are more!

From a database design standpoint, it is seldom a good idea to make the
value of one field dependent on the value selected in another field in that
same table. And some would state that more strongly, as in NEVER do it!

If you are not yet familiar with the terms "normalization" and "relational
database design", take the time now to learn about them before trying to get
Access to do things for you. This falls into the "pay now or pay later"
category...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
L

Lord Kelvan

to talk further on what jeff said you dont store calculated data in a
table thats what a query is for

if the second field is dependant on the first it is classed as
calculated ie

for states
(if i get any of these wrong i am sorry i am not american)
state statecode
new york NY
texas TX

in your query you can do a little calculated field using an iff
statement to generate the second field

Regards
Kelvan
 

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