Solved

Automatically fire After Update event on all records in form using existing data

Posted on 2013-06-13
6
272 Views
Last Modified: 2013-06-13
Here is my situation.  I have existing data in a field called ITP Date.  I have added additional fields which are calculated based on the data entered in ITP, (but again, the data is already there).  Is there any way to get the new fields to update without rekeying the data into ITP?

Thanks.
0
Comment
Question by:manndo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 58
ID: 39244794
You'd want to use an update query against the table.

Jim.
0
 
LVL 11

Expert Comment

by:HuaMinChen
ID: 39244803
Use DB trigger to further update other column upon the change of a specific column (in this case which is ITP date). Read
CREATE TRIGGER
0
 

Author Comment

by:manndo
ID: 39244906
The AFter Update Event is on the form.  Re-entering the data into the table does not fire the After Update event, thus the other fields based on the After Update event are not calculated.  The After Update event placed on the ITP field is this......

Me.[1st Review] = DateAdd("d", 90, Me.ITP)
Me.Redevelopment = DateAdd("d", 365, Me.ITP)

Neither the 1st Review field or the Redevelopment fields are updated after running Update query on the Table.  Thanks again for your help.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:BAKADY
ID: 39244972
I have added additional fields which are calculated based on the data entered in ITP, (but again, the data is already there).
what are the default values these fields??? are they NULL???

1. About triggers, you can create them to catch INSERT, UPDATE and DELETE events, but not for ALTER TABLE...
2. About your new fields if thes are NULL you can recalculate then...
3. After that you need to create a trigger to calculate new records, or do this at program level.
4. If you cann't do #3 you have to recalculate your fields before each data request, but only them who are NULL, in this case an index can speed up the process.

regards
0
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39244976
<<Neither the 1st Review field or the Redevelopment fields are updated after running Update query on the Table.  Thanks again for your help. >>

 You'll need to refresh the forms recordset after you run the update query.

 I'm assuming you wanted to do this as a one time only.

 In your update query, drag down the 1st Review and Redvelopment fields.

 On the update line under those columns, do:

DateAdd("d", 90, [ITP])

and

DateAdd("d", 365, [ITP])

 Execute the query.  Now check the table; are the fields updated?  

 If so, then either close/open the form or hit F5 to refresh the data.

From this point forward then, you form shoul dbe updating the fields/records with the AfterUpdate event of the ITP control.

Jim.
0
 

Author Closing Comment

by:manndo
ID: 39245073
Thank you Jim.  Your solution is what I was looking for on this one.  It worked great.  I really appreciate it.  Yes.  It was a one-time thing and from now on when data is entered on the form, the After Update event will update the fields.  Thanks again.
0

Featured Post

 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question