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!

Auto update with date

Status
Not open for further replies.

pavewayammo

Programmer
Feb 12, 2003
53
0
0
US
Ok I have looked through all the FAQ's and searched the forum for this but just can't find the help I need. Here is what I am trying to do.

I have 3 fields (DateSubmitted, LeaveStr and LeaveEnd). I need the DateSubmitted to be updated with the current date when either of the other two fields (LeaveStr and LeaveEnd) gets changed. Now the DateSubmitted locked so the user can't cahnge the field but the date does change when the other two get changed.

Thanks in advance.

paveway [machinegun]

Looking for help check the FAQ's first then do a search then ask. Worked for me.
 
Your description here refers to fields getting changed and updated but I am going to assume that this is all happening on a form by the User. There are controls on your form that allows the user to change the fields/controls LeaveStr and LeaveEnd. It is upon the update or change of the values of these two controls that you want the control/field DateSubmitted to be updated with the CurrentDate.

Put the following VBA code in the AfterUpdate event procedure of each of the two controls LeaveStr and LeaveEnd:

Code:
Me.DateSubmitted = Date()

Post back with any questions.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
pavewayammo
When you say your [DateSubmitted] control is locked, I assume however it's still Enabled. Correct?

If so, have you tried putting code on either the OnChange event or the AfterUpdate event for [LeaveStr] and [LeaveEnd] to update [DateSubmitted]

Something such as...
Code:
Private Sub LeaveStr_Change()
Me.DateSubmitted = Date
End Sub

or
Code:
Private Sub LeaveStr_AfterUpdate
Me.DateSubmitted = Date
End Sub

Then put the same on the LeaveEnd control.

Which you use will depend upon how you enter and exit the LeaveStr and LeaveEnd controls.

Hope that helps.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top