automatically update field

G

Guest

Hi

I have a combo box with two columns - product & stock code. When I select a
product I want the the stock code column which I have in my table to
automatically populate. Is this possible to have on the actual main table?
 
G

Guest

Yes - you could use the AfterUpdate event of the combo to set the value of
the control bound to the field holding the stock code.

But - why ?

You already have the stock code so it seems you want to store it again
(twice in the same table or - even worse - in another table). Both of these
are very bad ideas. You should use the relationship between the stockcode
and anything else to run whaever it is you are needing to do.
 
J

John W. Vinson

Hi

I have a combo box with two columns - product & stock code. When I select a
product I want the the stock code column which I have in my table to
automatically populate. Is this possible to have on the actual main table?

First off, you should NOT be working in table datasheets: use a Form instead.

Secondly, most developers recommend that you not use combo boxes in tables (by
all means use them on forms though): see
http://www.mvps.org/access/lookupfields.htm for a critique.

But most important - if the stock code can be unambiguously determined from
the product, then you should NOT store both in any table other than the
product table itself; one of these fields is presumably the primary key of the
product table, and that value is the only one which should be stored in any
other table. You can use a combo box, a query, or other tools to look up the
other field as needed.

John W. Vinson [MVP]
 

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

Similar Threads


Top