Date field with Calendar selection

  • Thread starter Thread starter Caroline
  • Start date Start date
C

Caroline

I have a form that has a date field. I would like to be
able to select the date for this field from a calendar
that "drops down" from the field. I have seen this before
but not sure how it was done. Any help greatly
appreciated.
 
Caroline,

You can use a Date / Time Picker control for this; while in design view, go
to menu item Insert > ActiveX Control, and scoll down to find Microsoft Date
and Time Picker Control.
Two things you need to be cautious of:
1) a DT picker control will always default in the Date it was created on;
you will need a line of code behind some event (e.g. form event On Current,
condition Me.NewRecord) to set it to, say, current date.
2) although you only see a date, the control has a time part as well, so if
you use it in, say, a quey parameter you might wonder why no records are
returned while you expected them to; the reason is the date field in a table
may be, for instance, 06/14/2004, which Access interprets as 06/14/2004
00:00:00, and the DT Picker may display 06/14/2004 wjile its actual value is
06/14/2004 14:32:19, so the two are not equal! The way around this is to use
an Int() function on the control when using it as a query parameter, so as
to "strip off" the time part.

HTH,
Nikos
 
Back
Top