autofill previous date

G

Gary

I have numerous records to enter using the same date on a form. (it is not
the current date and it will change) I don't want to retype the same date for
each record. I am very new to access and have tried several suggestions but
they haven't worked. My field is called Date.
 
J

Jeanette Cunningham

Gary,
The name of your field is probably the reason that the suggestions you tried
didn't work.
Date is a reserved word that has special meaning in Access and shouldn't be
used for a field name.
Rename it to something like OrderDate, AssessmentDate, CallDate or similar.
For a date field the default value is written like this:

Private Sub TxtTheDate_AfterUpdate()
If Not IsNull(Me.TxtTheDate) Then
Me.TxtTheDate.DefaultValue ="#" & Me.TxtTheDate & "#"
End If
End Sub

Replace TxtTheDate with the name of the textbox control for your date field.

Jeanette Cunningham
 
K

Klatuu

In the After Update event of the date control:

Me.MyDateControl.DefaultValue = Me.MyDateControl
 
G

Gary

Thank you, changing the name did it, this puts in the date in a new record in
the form but gets stuck and won't continue on to another record (the new
record button is greyed out too.
 
G

Gary

Never mind. I found my problem. Thank you so much for your time and expert
advice.
Take Care
 

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

Top