Entry of Dates question

  • Thread starter Thread starter Becky
  • Start date Start date
B

Becky

hello

This is a newbie question, but here goes. My form has a combobox in the
header (cboYear) where the user selects a year, say 2007. The detail section
of the form then shows customer records in a continuous form.

One of the fields is txtDate. I'd like the user to just enter, say, 11/6
and have the date November 6, 2007 stored in the underlying table for later
use in reports. The user currently spends a long time keying in dates or
selecting from a calendar. It would go much quicker if she could just enter,
for example, 11/6 12/31 1/9 etc. on the numeric keypad to get Nov 6, 2007
Dec 31, 2007 Jan 9, 2007 etc.

What's a good way to do this?

Much thanks
Becky
 
Use the AfterUpdate event procedure of the text box to correct the year if
it differs from the filter combo.

This kind of thing:

Private Sub txtDate_AfterUpate()
If Year(Me.txtDate) <> Me.cboYear
Me.txtDate = DateSerial(Me.cboYear, Month(Me.txtDate),
Day(Me.txtDate))
End If
End Sub

Note that swapping years like that could cause abberations for Feb 29.
 
Back
Top