automatic date insertion

Ravenray

Registered User.
Local time
Today, 18:43
Joined
Nov 21, 2003
Messages
32
OK, I have this code here:

If Me.txtEstimatedDate = Now() Then
Me.DateExited = Now()
End If

I used it under afterupdate under the DateExit field, but it's not working. So I'm taking it that I'm doing something wrong here.

I have one field called DateEntered. txtEstimatedDate takes DateEntered and estimates 90 days. What I wanted to do was if Today = txtEstimatedDate, it will automatically stamp DateExited.
 
=Now() will give you the date and time like 01/05/2004 13:33:04. The odds that you hit the exact date and time down to the seconds is pretty slim.

You should use =Date() instead.

HTH
 
As I understand it, Now() is for time and Date() is for calander dates.

Try using =Date() instead.

What code are you using to estimate 90 days into the future by the way?
 
Ok, I changed it to =date(), but when I did that, it changed it to =date.
 
hmmm. Still doesn't stamp the field with that date. Should it be under Afterupdate?
 
Wait, I got it......I had to tab to the field and then it stamped it. Hmm would this work if I used upon opening the form?
 
You need to move the code from the control event where you have it now to the FORM's BeforeUpdate event. That way the code will run whenever ANY form field is modified.
 
Ok, got it. Actually, I used Onload and it work perfectly.
 
You should not use the Load event. Your code will "dirty" the record causing it to be updated even if the user doesn't change anything.
 
Pat, that's what is needed to kind of self automate. Even if they don't go into that record they can still see it from a query and it will be a reminder to the user to go into that record to double check on the recorder before closing it out.
 

Users who are viewing this thread

Back
Top Bottom