By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,572 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

Update field in table b from form a

P: n/a
I'm new to Access and VBA. (I've been working with Pick/Universe forever.)
I'm about going nuts trying to figure out something that should be (and most
likely is) very simple.

I have a form that reads and writes data from/to a table (call it
mainTable). It also reads data from a 2nd table (call it secondTable). What
I can't figure out how to do is update an item in secondTable from a
calculation in the mainTableForm. Specifically, I would like to take a value
from secondTable, subtract a value from mainTable and write the new value
back on the same field in secondTable.

Suggestions?

Bob

Sep 30 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Robert Martin wrote:
I'm new to Access and VBA. (I've been working with Pick/Universe
forever.) I'm about going nuts trying to figure out something that
should be (and most likely is) very simple.

I have a form that reads and writes data from/to a table (call it
mainTable). It also reads data from a 2nd table (call it
secondTable). What I can't figure out how to do is update an item in
secondTable from a calculation in the mainTableForm. Specifically, I
would like to take a value from secondTable, subtract a value from
mainTable and write the new value back on the same field in
secondTable.
The reason you are not finding obvious ways to do this is that in a properly
designed database the results of calculations are rarely stored in tables. The
calculation required to get the result is simply performed any time the value is
needed. That being said, there are a number of ways to accomplish this. The
simplest might be to use an update query.

UPDATE secondTable
Set SomeField = SomeField - Forms!mainTableForm!ControlName
WHERE (I assume you need to have some criteria here)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Sep 30 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.