Solved

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

Posted on 2013-06-13
6
267 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
6 Comments
 
LVL 57
ID: 39244794
You'd want to use an update query against the table.

Jim.
0
 
LVL 10

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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 57

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

806 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