Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284

    Access not filtering on Combo list

    Greetings ~



    I'm using a form with ComboBoxes where users will select a value from the ComboBox which the database will then filter on that value to populate a ListBox.

    I have 9 of these ComboBoxes and 7 of the 9 work perfectly... The other two have begin shift times and end shift times stored in them and those will only filter correctly on one value, 12:00 AM and on a few others it will return only a partial of the total records while on most of them the filter will return nothing at all...

    Below is the code used to populate the ComboBoxes
    Code:
    SELECT DISTINCT Sheet1.[Shift Begin] FROM Sheet1 ORDER BY Sheet1.[Shift Begin];
    Below is the code used to trigger the filter event when a value is selected (or typed) into the ComboBox
    Code:
    Private Sub Combo72_AfterUpdate()
    
    'Filter on Shift Begin Time
    
    Me.List37.RowSource = "SELECT Sheet1.[Emp ID], Sheet1.[First Name], " & _
    "Sheet1.[Last Name], Sheet1.FullName, Sheet1.[Agent Email Address], " & _
    "Sheet1.Supervisor, Sheet1.Manager, Sheet1.Company, Sheet1.Location, " & _
    "Sheet1.[Shift Begin], Sheet1.[Shift End], Sheet1.[Contact #], Sheet1.[Shift Code] " & _
    "FROM Sheet1 WHERE (((Sheet1.[Shift Begin])=[Forms]![Sheet1]![Combo72])) ORDER BY Sheet1.FullName; "
    'Me.Combo72 = ""
    
    End Sub
    Any help with this mystery would be greatly appreciated ~

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Time is very finicky. Create a new query to test what your filter should look like, adding in the criteria line the same as you enter in the combobox. Then you can see what format it should be.

  3. #3
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Hey Aytee ~

    Gave it a shot...no luck. I can pull all the 12:00 AM records but nothing else...

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Show us what the data on the record(s) looks like, and what the data type is.

    Add a line of code:
    Debug.Print Me.List37.RowSource
    and see what it is displaying. You can use this SQL string to copy and paste into a query.

    Also add:
    Me.Lsit37.Requery

  5. #5
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Hey Aytee...
    Okay...
    Debug just showed the string above
    Requery had no affect
    DataType = Date/Time

    Here is a sample of what the times in the Shift Begin field look like:
    Shift Begin
    7:00:00 AM
    7:00:00 AM
    8:30:00 AM
    8:30:00 AM
    4:00:00 PM
    4:00:00 AM

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    So, you enter "7:00:00 AM", go to the table, find all the records that display that. The query you created in post #3 should match this. Or from the other side, go to the table and find a time, then put that into your query as criteria and see if it is showing correctly.

    It should come out something like
    WHERE (((Sheet1.[Shift Begin])=#7:00:00 AM#))

  7. #7
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Hello Again ~

    Yes... The code, when entering the actual value looks just like above...However, the results are the same...The only time it returns a an accurate filter result is when I filter 12:00 AM

    Even when I perform a manual filter action in the table itself it will only work on 12:00 AM...which, imo is just insane...

    Why would Access recognize the values in the manual filter dropdown or load the different times into the ComboBox then pretend those values do not exist when attempting to filter on them either directly in the table or with VBA

    I get it that Microsoft is horrible with times (and dates ftm) but this is just crazy...

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You're right, this isn't making sense. Can you post your database, with some sample data?

  9. #9
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Hey Aytee... I'm trying to send a PM to you with the db attached... but there seems to be no way to attach the file ?? Any suggestions?

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    To attach:
    - click on Go Advanced
    - look for the attach icon, a new window will open for you to upload a file

  11. #11
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Well so much for that... Unfortunately the Admin's on this site have limited the size of uploads to 500 Kb... (which seems rather small for Access)
    I have gutted my db down to 1 form and 1 table consisting of 50 records and I'm still at 532 Kb...
    I would have to eliminate the entire table to get even close to 500...

    Can't thank you enough for sticking with me on this one Aytee, but it looks like I'm on my own

  12. #12
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Zip it first.

  13. #13
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Here you go ~
    Attached Files Attached Files

  14. #14
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    It is your data. I added a new record and everything worked fine. What Access is displaying is not what is actually in the shift begin field. Where does this data come from?

  15. #15
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Imported from Excel...The format in Excel is date

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-04-2017, 07:22 AM
  2. Replies: 1
    Last Post: 07-12-2012, 08:39 AM
  3. Replies: 5
    Last Post: 03-12-2012, 02:58 AM
  4. list form filtering from 1 combo box
    By cooper in forum Forms
    Replies: 5
    Last Post: 08-18-2011, 05:32 PM
  5. Replies: 0
    Last Post: 08-17-2008, 12:19 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