Data entry with the previous year's data.

B

Balkar

Now that the new year has come, when I type in a date in a date field the new
year is appeneded (ie. 12/1 becomes 12/1/2009) Is there any way to make it
append 2008 (last year) since it's the "closer December" to the current date
(without changing the computer's system date)?

To make matters worse I'm using Access 2002 with an Access 97 File format.
 
K

Ken Snell \(MVP\)

You could use the text box's AfterUpdate event to do this:

Private Sub NameOfTextBox_AfterUpdate()
If Month(Me.NameOfTextBox.Value) = 12 And _
Month(Date()) <= 2 Then _
Me.NameOfTextBox.Value = DateAdd("yyyy", -1, Me.NameOfTextBox.Value)
End Sub
 
J

Jeff Boyce

Ken offers a mechanism for handling December.

Are you going to need to do the same kind of thing (go back to last year)
for any other months?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

Balkar

Thank you. I do know enough to alter his code for my specific needs. I was
mostly hoping that there was a setting for the autocomplete but I guess not.

Thanks again.
 
J

Jeff Boyce

As I understand it, Access autocompletes a value in a date/time
control/field with the current year. I'm not aware of a "closest year"
setting.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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