Re: problem getting a value from Date()
- From: "Arvin Meyer [MVP]" <a@xxxxx>
- Date: Sat, 3 May 2008 23:12:25 -0400
Your code should work. Your MsgBox example should be:
? MsgBox(Date())
or
? MsgBox(Date)
You can't use a msgbox as a statement in the Immediate Window, you need to
use the function.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
"Paul" <begone@xxxxxxxx> wrote in message
news:%23oZnB%23YrIHA.1772@xxxxxxxxxxxxxxxxxxxxxxx
I'm trying to write a line of code that will update a date field (txtDate)
in a form to the current date whenever a value in another field is
changed. To that end, I've tried using the following:
Private Sub Activity_AfterUpdate()
Me!txtDate = Date()
End Sub
but it doesn't do anything. That is, it doesn't enter today's date in
txtDate.
I've also noticed that in the Immediate pane, ?Date() produces the current
Date, but MsgBox Date() produces an error becuase Date() is null.
Why does VBA recognize Date() in the immediate pane as having a value of
today's date, while the MsgBox function thinks it has no value? And what
can I do to reset txtDate to today's date whenever the value in the
Activity field is updated?
Thanks in advance,
Paul
.
- Follow-Ups:
- Re: problem getting a value from Date()
- From: Paul
- Re: problem getting a value from Date()
- References:
- problem getting a value from Date()
- From: Paul
- problem getting a value from Date()
- Prev by Date: Re: IIF Statement - Expression Builder MS Access
- Next by Date: Re: problem getting a value from Date()
- Previous by thread: problem getting a value from Date()
- Next by thread: Re: problem getting a value from Date()
- Index(es):
Relevant Pages
|