Results 1 to 5 of 5
  1. #1
    menken is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    3

    Datasheet won't update based on combo box


    I have a split form based on a query. In the header I have a combo box that works as a filter for the query. So when I change the value of the combo box I expect the datasheet to update (On Change Event Requery). Now the problem is that the datasheet doesn't reflect the new filter.

    When I execute the query itself (which is linked to the combo box) everything works fine. Also, when I update an underlying table of the query (e.g., add a new entry) and then change the value of the combo box, the new entry will show up in the datasheet, but not the filter. So based on that I conclude that the query is right and also the event works.

    Any idea what's going on? I'm getting insane over this...

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Don't use a split sheet. I use a continuous form,the combo (in the form header) changes,and the filter works...
    Code:
    sub cboBox_afterupdate()
    If IsNull(cboBox) then 
        Me.filterOn= false
    else
       Me.filter ="[id]=" & cboBox
       Me.filterOn= true
    end sub

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    What code are you using to do the filtering?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    menken is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    3
    It's a simple WHERE-clause in the query:
    Code:
    WHERE (((Dienstleistungen.DienstleistungID)=[Forms]![F_Lieferanten]![DienstleistungName])) OR ((([Forms]![F_Lieferanten]![DienstleistungName]) Is Null))
    And for the combo box I have defined an On Change event procedure:
    Code:
    Private Sub DienstleistungName_Change()
        Form_F_Lieferanten.Requery
    End Sub

  5. #5
    menken is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    3
    For some mysterious reason it works now, even though I haven't changed anything at all. Let's hope it stays like that...

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

Similar Threads

  1. Replies: 6
    Last Post: 02-23-2016, 01:45 PM
  2. Replies: 5
    Last Post: 04-29-2013, 04:23 PM
  3. Replies: 1
    Last Post: 02-03-2012, 03:51 PM
  4. Replies: 3
    Last Post: 12-06-2011, 11:32 AM
  5. Update a text box based on a combo box
    By fleschnj in forum Access
    Replies: 1
    Last Post: 11-08-2010, 12:14 PM

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
  •  
Other Forums: Microsoft Office Forums