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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Stumped By Dates 4
Restrict Previous Date 1
Date problem 5
WHats wrong with this query? 4
Find date 4
date calculations - please help 2
Convert number to date field? 6
Date and Time 3

Back
Top