Results 1 to 4 of 4
  1. #1
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010

    Access 2010 Date Picker Replacement

    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.


    Function FireOffDateValue()
    Me.myDate.Value = Me.myMonth.Value & "/" & Me.myDay.Value & "/" & Me.myYear.Value
    '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.

    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.
    Last edited by pkstormy; 08-04-2011 at 07:23 AM.

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010

    Access 2010 Date Picker replacement revised

    Here is a version where on the CalendarPopUp form, you can double-click on a date and it will write that date so you don't have to click the "Use Date" button.

  3. #3
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010

    2010 Date Picker Replacement with Buttons

    Same as above except with buttons to change the Month and Year.

  4. #4
    delphinas is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    It's absolutely awesome stuff. One thing I can't figure out. At the moment it displays date like mm/d/yyyy . I've changed it through the fireof function(at the end) to show date like this: dd/m/yyyy. Now I need it to show like this dd/MM/yyyy. E.g if I select 1st day, it shows like 1/02/2012 but I need "0" in front like 01/02/2012.

    How to do it ?
    Thank you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date Picker?
    By gazzieh in forum Forms
    Replies: 9
    Last Post: 02-09-2013, 09:35 AM
  2. Date Picker
    By otisdaddy in forum Database Design
    Replies: 2
    Last Post: 07-01-2011, 12:30 PM
  3. Date picker
    By BI4K12 in forum Access
    Replies: 1
    Last Post: 06-09-2010, 11:11 AM
  4. Access 2003 - how install MS Date Picker
    By alexcalgary in forum Forms
    Replies: 3
    Last Post: 05-20-2009, 09:12 AM
  5. Access Runtime 2007 Date Time Picker Vista not working
    By sailinxtc in forum Programming
    Replies: 0
    Last Post: 09-17-2008, 12:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums