Results 1 to 5 of 5
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    SAYT Combo Box

    I generally put this code snippet in my On Key Down combo box event.



    Code:
    Private Sub cboLastNameSearch_KeyDown(KeyCode As Integer, Shift As Integer)    
    
           Me.cboLastNameSearch.Dropdown
    
    End Sub
    It makes for a much easier search of long lists of names, SS numbers etc. A few keystrokes and wala!, their selection is nicely filtered. I have a list of 100,000 names. Here is my rowsource sql.

    Code:
                    SELECT DISTINCT  Applicant.Appl_Lname, Applicant.Appl_Fname, Applicant.SSN 
                          FROM Applicant 
                          ORDER BY Applicant.Appl_Lname, Applicant.Appl_Fname;
    I've hidden the SSN, but I want to do something with it later and I want the user to start typing the last name till it narrows down on the desired name. When selected the code grabs the SSN and populates the form. The problem is the combo box only displays about half the list, down to the "M"s. If you start to type Smi, you will see Smith in the box you are typing in, but the dropdown will be stuck on Miller.

    Is there a limit on the number of names viewable in a combo box?


    p.s. Sorry for the mangled post. I've just repaired it. Something about this website has been causing my work PC to crash. Not sure what's causing it. Never happened before I took this job.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Well, after I adapted it to my tables, that code worked. While I was doing this, it ocurred to me that I have another combo box where the SSN is the search key and the same thing is happening there. Only half of my SSN are showing there. I must say, I'm not pleased with this limitation on combo boxes and I don't really want to duplicate all this code, as good as it is, so I may create some new variables that will adapt this code to multiple combo boxes ... or I may not. Time is becoming an issue.

    Thanks for pointing me at a solution though. I'll decide what to do later.

    Paul

    Paul

  4. #4
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    As an addendum to this post, There is a RowSource SQL that contains this string, "WHERE(False)". I've never seen that before, but it seems intentionally designed to return zero records. Is that a standard trick of sorts. Is it commonly used?

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    On the plus side I did adapt my code to work with multiple combo boxes by calling the function from the On Change event and passing the source combo box and row source SQL via variables.

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

Similar Threads

  1. Replies: 7
    Last Post: 03-30-2015, 10:04 AM
  2. Replies: 2
    Last Post: 10-21-2014, 07:57 AM
  3. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  4. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  5. Replies: 4
    Last Post: 08-16-2011, 05:54 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