Update subform

  • Thread starter bhrosey via AccessMonster.com
  • Start date
B

bhrosey via AccessMonster.com

I have a form to locate parts. I also have a subform linked to a different
table to track when and how many parts were taken out of inventory. I want
the operator to fill in the date in the main form ( because I'm using that
somewhere else also), but I want that date to populate the subform's
transaction date. How do I keep from changing ALL the dates in the subform?
 
A

Allen Browne

If any of the related records in the subform had a date that did not match
the date in the parent table, would that be wrong?

If your answer is Yes, then you must not store the date in the subform's
table. Doing so breaks basic relational rules, and creates a maintenance
nightmare. Use DLookup() to get the date from the parent table instead:
http://allenbrowne.com/casu-07.html

If your answer is No (i.e. there could be valid cases where the related
record could be different), execute an Update query statement in the
AfterUpdate event procedure of the main form to effect the change to all the
related records. You will build a query statement on-the-fly in this event,
and execute it. Here's an explanation of how to do that and suppress the
confirmation dialogs:
http://allenbrowne.com/ser-60.html
 

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