update query

O

orek

is there a way in which i could insert or update a field in a table using a
value calcuated in a query to an existing row in the table?

now in one of my table i got
inv client total
01 0001
02 0003
in a query
inv sum
01 HK$100.00
02 HK$190.00

and i want to insert the sum of the query to the total in table to create

inv client total
01 0001 HK$100.00
02 0003 HK$190.00
 
J

John Vinson

is there a way in which i could insert or update a field in a table using a
value calcuated in a query to an existing row in the table?

now in one of my table i got
inv client total
01 0001
02 0003
in a query
inv sum
01 HK$100.00
02 HK$190.00

and i want to insert the sum of the query to the total in table to create

inv client total
01 0001 HK$100.00
02 0003 HK$190.00

Don't.

Storing derived data such as this in your table IS A VERY BAD IDEA.

If you store 190.00 in the table, and then delete, edit, or add a
record, THAT STORED VALUE WILL BE WRONG, and you'll never know that
it's wrong.

If you say "but I have to have the value in my table in order to
create a report" - you don't. You can (and should) base the report on
a Query, or do the calculation directly in the control source of a
textbox on the Report; for instance, use the Sorting and Grouping to
group the report by client, and do the sum in the Group Header or
Footer.

If you can explain why you want to violate basic principles and store
this derived data, it can be done... I just want to be sure you're
aware why it generally should NOT be done.

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