Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Location
    USA
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calendar Control - Limit Dates (2000 (9.4.4119 SR-1))

    Is there a way to limit the Calendar Control on an Access form to only display a range of dates?

    Example: I want the user to pick any date between Jan 1, 2003 and Mar 31, 2004.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control - Limit Dates (2000 (9.4.4119 SR-1))

    The Calendar Control doesn't have properties for minimum and maximum dates. You can use the BeforeUpdate event to check the date - it has a Cancel argument that you can set to True if the user entered a date outside the valid range:

    Private Sub calCalendar_BeforeUpdate(Cancel As Integer)
    If calCalendar.Value < #1/1/2003# Or calCalendar.Value > #3/31/2004# Then
    MsgBox "Invalid date", vbExclamation
    Cancel = True
    End If
    End Sub

    Replace calCalendar with the name of your calendar control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •