Data entry with the previous year's data.

  • Thread starter Thread starter Balkar
  • Start date Start date
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.
 
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
 
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
 
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.
 
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
 
Back
Top