Results 1 to 5 of 5
  1. #1
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44

    Filter subform with date picker

    Good day.



    I have a form ("frmSchedule") with a subform ("subfrmSchedule" which is in datesheet view). The subform's record source is from "qrySchedule", where the date's control source is from "GameDate" (this is also the name of the control and is in text box type). The query lists many records with the same date. For example, some records has the date October 12, 2016, followed by some records having a date October 13, 2016, etc.

    On the main form, I have an unbound combo box with its row source as "SELECT [qrySchedule].[GameDate] FROM qrySchedule;". The combo box also has an After Update event to filter the subform:

    Private Sub Date_AfterUpdate()
    If IsNull(Date) Then
    DoCmd.ShowAllRecords
    Else
    DoCmd.ApplyFilter , "[GameDate] =" & Me.Date & ""
    End If

    End Sub

    The issue is that the contents of the combo box lists multiple dates of the same date (following example):

    October 12, 2016
    October 12, 2016
    October 12, 2016
    October 12, 2016
    October 13, 2016
    October 13, 2016
    etc.

    How can I list the dates in my combo box to only show a date once? I tried using the date picker but was unsuccessful at it.

    Thanks in advance.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you ever used the "Distinct" verb in SQL?

  3. #3
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Lol.

    Actually, I found the solution.

    I had to go into the query and set "Unique Values" to Yes.

    Cheers.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Go ahead and use the Thread Tools at the top of the thread to mark this thread as Solved!

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    BTW, thanks for posting back with your success and solution.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-28-2015, 08:17 PM
  2. Replies: 11
    Last Post: 06-28-2015, 06:42 PM
  3. Replies: 1
    Last Post: 05-23-2014, 06:04 AM
  4. Show Date Picker on Load and Verifying Date
    By Markb384 in forum Forms
    Replies: 4
    Last Post: 03-04-2014, 07:44 AM
  5. Replies: 6
    Last Post: 11-18-2013, 12:03 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