Results 1 to 7 of 7
  1. #1
    Whale is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    4

    Filter On Focus On Combo Box Not Incrementing

    Didn't know a better way to explain it.

    I am making an advanced client search function. To do this I have created a continuous form and added a search text box to the header.



    The intent is to type one or more letter as it applies to the client name and the list to filter according to the letters entered.

    The problem is if I want to enter Pi for example I enter P and then enter I however instead of showing PI the combo box is showing I only. This is very annoying, and I can only see to move the focus to the other combo box and then click back in the original combo box as a fix...this isn't a fix, the sample database is some 5 or so clients, the actual is 5500 and the search must be fast at the counter.ExplainIssue.zip

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Here is a solution that might work for you if I am understanding your issue correctly

    http://www.datapigtechnologies.com/f...tomfilter.html

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You do know you are violating normalization rules??

    As far as the combo box, you have set the insertion point to the end of the string in the combo box.
    Try this:
    Code:
    Private Sub cboFilterName_Change()
        Dim FilterString As String
    
        If Nz(Me.cboFilterName.Text) = vbNullString Then
            Me.Form.Filter = vbNullString
            Me.FilterOn = False
        ElseIf Me.cboFilterName.ListIndex <> -1 Then
            Me.Form.Filter = "[CN] ='" & Replace(Me.cboFilterName.Text, "'", "''") & "'"
            Me.FilterOn = True
    
            'if a partial value is typed, filter for a partial match
        Else
            'Me.Form.Filter = "[CN] Like '*' &  '" & Replace(Me.cboFilterName.Text, "'", "''") & "'  & ' * '"""
    
            FilterString = "[CN] Like '*" & Replace(Me.cboFilterName.Text, " ' ", " '' ") & "*'"  '<< I modified this string
            '        Debug.Print FilterString
    
            Me.Form.Filter = FilterString
            Me.FilterOn = True
    
           '====================================
           'set the insertion point to the end of the combo box text property string
            Me.cboFilterName.SelStart = Len(Me.cboFilterName.Text) + 1
           '====================================
    
        End If
    End Sub

  4. #4
    Whale is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    4
    Thanks Steve. That's perfect for the solution I am needing for this.

    I am not sure what you mean by not following normalisation rules? Where? Nothing would surprise me now. Haven't done anything much with Access for nearly 10 years.

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There are many links out there explaining what "database normalisation" means, it is to do with table design and database structure. By following those rules you have a far stronger and more robust database design - and life becomes far easier!

  6. #6
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Take the time to read the white paper on db design at this link to understand normalization

    http://r937.com/relational.html

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also see:

    Normalization Parts I, II, III, IV, and V
    http://rogersaccessblog.blogspot.ca/...on-part-i.html


    Entity-Relationship Diagramming: Part I, II, III and IV
    http://rogersaccessblog.blogspot.ca/...ng-part-i.html

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

Similar Threads

  1. Replies: 11
    Last Post: 09-03-2015, 11:12 AM
  2. Combo Box Values to Go Blank on Lost Focus
    By McArthurGDM in forum Forms
    Replies: 6
    Last Post: 02-20-2015, 01:22 PM
  3. Replies: 3
    Last Post: 10-30-2013, 05:59 AM
  4. Replies: 2
    Last Post: 06-26-2012, 10:54 PM
  5. Replies: 6
    Last Post: 05-05-2012, 08:43 AM

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