Getting Date Only

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can not get the date to appear in a field automatically after a certain
event occurs. Here is the code:

AfterUpdate for strRequestStatus Field
If Me.strRequestStatus = "Closed" Then
dteDatedClosed = Date
End If

I have tried on lost focus,
I have tried using Date(), have tried setiing the date to short date,or
formatting to mm/dd/yyyy.
At one point I clicked in the field the date showed up,but went away when I
saved the form.

This is the same code I used in another database using Now() instead with no
problem.
 
AFTER update fires AFTER you have updated (saved) the record.

Do it in the BEFORE update evnet, and it should be,,,

dteDatedClosed = Date()
 
Are you sure the value of the field is "Closed"? If the status field is a
combo, the actual value will probably be numeric.
 
CyndyG said:
I can not get the date to appear in a field automatically after a
certain event occurs. Here is the code:

AfterUpdate for strRequestStatus Field
If Me.strRequestStatus = "Closed" Then
dteDatedClosed = Date
End If

I have tried on lost focus,
I have tried using Date(), have tried setiing the date to short
date,or formatting to mm/dd/yyyy.
At one point I clicked in the field the date showed up,but went away
when I saved the form.

This is the same code I used in another database using Now() instead
with no problem.

This is in the AfterUpdate event for the control named
"strRequestStatus"?

Do you have a control or public variable named "Date"? That could be
confusing Access and VBA.

Have you set a breakpoint and stepped through the code to see that it
executes the statements you think it does? If it fails the test in the
If statement, check the value of strRequestStatus to make sure that it's
really what you think it is.
 
Back
Top