How to update a table field from a calculated form text box

G

Guest

I have several text boxes in a form that have the control source of a Dlookup
expression. I would like to take the result of these Dlookups and update
various fields in the table that is used for the form. For example. I
lookup a cost (using Dlookup) based on a part #, then I would like to update
this cost back into a table. any thoughts?
 
G

Guest

Hi jimgea,

You need to work out what event is going to trigger this update, then either
run some SQL code, or if you have a field on your form bound to the database
field, assign the value to the bound field.

As a general rule you never want to save anything you can calculate, however
if your example is relating to a cost that you want to record on an invoice
(based on the "current" cost of an item), then it is valid.

If you are selecting an item from a combo, perhaps assign the cost in the
after-udpate event of the combo box?

Hope this helps.

Damian.
 
G

Guest

How about creating a Select query to gather the calculated results and
whatever fields you need, buiild a Temp table using the make table query, and
then an update query to update the table you want with the Temp table's
values. Then delete the Temp table when you are done. If this makes sense
(I do this quite often), I will send you some code I have created.
 

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