DefaultValue and Dates

BillNorton

Registered User.
Local time
Today, 07:58
Joined
May 23, 2001
Messages
27
I'm afraid my Access skills have gotten pretty rusty over the past three or four years, so I hope this question isn't too obvious.

I have a form with a text box for entering a date on it and I want the last date that the user entered to become the DefaultValue for that text box. Here is the code that I thought would work:

Code:
Private Sub Form_AfterUpdate()
If Not IsNull(Me.txtDate.Value) Then
    Me.txtDate.DefaultValue = Me.txtDate.Value
End If
End Sub

Instead of the date the user entered for the DefaultValue, I get what looks like a Null date, i.e., 12/30/1899.

I've tried lots of variations on this but with no luck.
 
Aha, I found it. I needed to do this:

Code:
Me.txtDate.DefaultValue = "#" & Me.txtDate.Value & "#"
I'd taken that approach earlier but I had used + instead of &. Like I said, it's been awhile.
 

Users who are viewing this thread

Back
Top Bottom