Access 2010 Date Picker Replacement (1 Viewer)

Status
Not open for further replies.

pkstormy

Registered User.
Local time
Yesterday, 21:45
Joined
Feb 11, 2008
Messages
64
This is a NON-ActiveX based and NON-API based Calendar looking form replacement for the Date Picker control in MSAccess 2010 (which requires you to click on a date field and then a calendar button to show the popup calendar). Since Access 2010 removed the mscal.ocx activeX control, the Access 2010 "Date Picker" is the only option. You must either replace the mscal.ocx control or register it separately (which I haven't tried yet.) Access 2007 did keep the mscal.ocx control. Why they removed it from 2010 is a good guess but there were probably some issues with it to maintain compatibility with 2010.

There are 2 forms, one to use as a subform and another which is a popup/modal and can be called from an OnClick or other event.

There is a subform ready Calendar looking form called: subCalendar that can be inserted into any main form (all the coding is embedded into the subform so you don't need to import any modules or queries or any other objects - just the form called: subCalendar into your accdb.) I used the .Caption to cycle through the buttons to determine the day value when a button is clicked which prevented the need for any API type coding.

IMPORTANT: The last function in the subCalendar form is called: FireOffDateValue. To use this form as a subform in your main form, simply put your coding in this function to populate any date value or requery any listbox/combobox on the main form.

example:

Function FireOffDateValue()
Me.myDate.Value = Me.myMonth.Value & "/" & Me.myDay.Value & "/" & Me.myYear.Value
Refresh
'Replace below with your code...
Forms!frmAvailabilityStaff!CalDate = Me.myDate.Value
Forms!frmAvailabilityStaff!ListDates.Requery 'Note that I requery after populating CalDate on the Main form since this listbox is based on the CalDate value.
End Function

Also included is a popup/modal version of the form called: CalendarPopUp
This form is to be used with a 'Calendar' type button (or any event procedure on any object) on the main form (or subform) - (see frmExamplePersons and the calendar button on that form for example coding to use for both main and sub forms). You basically issue a docmd.openform "CalendarPopUp" to open the form and then pass it 2 or 3 values (vFormName, vSubFormName, and vFieldName.) These are the same form names and field name from the form which you are opening the CalendarPopUp form.

Example:
me.BirthDate.setfocus 'to send the current Birthdate to the Calendar Popup
DoCmd.OpenForm "CalendarPopUp"
Forms!CalendarPopUp!vFormName = "frmExamplePersons"
Forms!CalendarPopUp!vSubFormName = "EnterSubformNameHere" for using with subforms!
Forms!CalendarPopUp!vFieldName = "BirthDate"


Also Note: This is in an accdb (2010) format.
 

Attachments

  • PKStormysCalendarControlFor2010.zip
    125.5 KB · Views: 2,927

pkstormy

Registered User.
Local time
Yesterday, 21:45
Joined
Feb 11, 2008
Messages
64
Here's a revised version with buttons to change the month or year and the ability to double-click on a date in the CalendarPopUp form.

Also a 2003 version.
 

Attachments

  • PKStormysCalendarControlFor2010Buttons.zip
    142.3 KB · Views: 1,893
  • PKStormysCalendarControlFor2003.zip
    145.1 KB · Views: 921
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom