Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value of a field = another field

Status
Not open for further replies.

jovuco

ISP
Oct 30, 2001
17
0
0
US
How do I take the value of a field in one table and have it equal the value of another field in another table?

I need the sum up a group of "Price" fields and have that sum entered into a Subtotal field in another table. I have a table with the "Price" field, and in another table have the "Subtotal" field that I want to place the sum of the price field into.
 
Something like this:
on exit from me!FromFld (in events)

dim MyRe as dao.Recordset, MyDb as dao.Database
set mydb = currentdb

'As I am not sure if you want to alter(edit) or addnew here goes
'Addnew
Set myre=mydb.openrecordsource("Select * From YrTbl")
myre.addnew
myre!yrFld= me!FromFld
myre.update

'edit

Set myre=mydb.openrecordsource("Select * From YrTbl Where ID=" & me!id)

myre.edit
myre!YrFld=me!FromFld
myre.update

Thata it ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top