Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012

    Unanswered: Open form based on date field criteria

    Hey Y'all,
    I'm designing a database for my company and am attempting to create a calendar-like form for scheduling and whatnot. I want the user to be able to double click a specific calendar date and have a form pop up with all the items scheduled for that day. However, I'm having trouble using a date as a criteria for the pop up form. This is what I have so far:

    Private Sub List748_DblClick(Cancel As Integer)
    Dim EventD As Date
    EventD = (Me.numMonth & "/10/" & Me.txtYear)
    DoCmd.OpenForm "Calendar Day", , , "[EventDate] = " & EventD, acFormEdit, acDialog
    End Sub

    Unfortunately the form loads blank, because the date criteria doesn't pass anything.

    Thanks for your help!

  2. #2
    Join Date
    May 2012
    Figured it out!
    I replaced what I had above with:

    DoCmd.OpenForm "Calendar Day", , , "[CalanderDay] = " & "#" & Me.numMonth & "/10/" & Me.txtYear & "#", acFormEdit, acDialog

    I was just missing the hashtags. Whoops.

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    Glad you got it working! The 'hashtags' (#) are used by Access VBA as delimiters to signify that the Field is a Date/Time Field.

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Tags for this Thread

Posting Permissions

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