Autoupdate fields on a form, uses two tables

Lancer

Registered User.
Local time
Today, 15:52
Joined
Jan 29, 2003
Messages
33
Please look at my simple Access 2000 business database: http://www.bestsharing.com/files/6YcsupN277234/chem.mdb.html

On the form named "Chemical In"...

...this is where someone enters the amount of product they are purchasing along with the purchase date. At the moment, the form also expects them to manually enter the "price per unit" of the chosen item as well as the summative "purchase cost".

This is silly when "price per unit" is obtainable from the "Chemical List" table, and the purchase cost would simply be price per unit * amount.

To prevent the inevitable eventual human error, I want to make those last two fields on this form to self update. They are only there to inform the user how much the cost is going to be as they key in the amount.

...but how do I do the auto updating bit? I've tried linking the textboxes to their respective fields, but they don't seem to cooperate (I just get #name whenever I try). Can someone please look at my database and tell me how to set the auto-updating fields up?
 
When you do a lookup, if it is from the table that contains unit price, look it up via a combo box and retrieve more than one field. Make the receiving text boxes have the same names as the retrieved fields in the combo box and the update will be automagic.

You can hide the extra looked up fields by making the width of the combo box on the form too narrow to show anything but the primary item looked up. Note you need this lookup item to be a prime key in the lookup table.
 
When you do a lookup, if it is from the table that contains unit price, look it up via a combo box and retrieve more than one field. Make the receiving text boxes have the same names as the retrieved fields in the combo box and the update will be automagic.

You can hide the extra looked up fields by making the width of the combo box on the form too narrow to show anything but the primary item looked up. Note you need this lookup item to be a prime key in the lookup table.

Sorry man, I'm completely confused by your answer. Look up?

I went to the table "Chemical In" and tried adding a lookup column containing price per unit. It gave me the error "You entered an expression that has an invalid reference to the property |" and refused to add the column.

I'm thinking I may need a bit more step by step, perhaps related to the download I gave. I'm not sure about primary keys, the common relationship thread is Unit name.

I'm also aware that there don't appear to be any primary keys in this thing. I'm thinking that I should make a column for this, but Access won't let me make an autonumber field... can I rescue the database tables?

Would you mind looking at my file and helping me with a few steps in how to make the lookup as you say? :confused:
 
Last edited:

Users who are viewing this thread

Back
Top Bottom