Results 1 to 4 of 4
  1. #1
    cnstarz is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    31

    Help Creating Searchbox with "suggestions"

    Hi! I have a table with last names, first names, ssn#'s, and other stuff, and of course i have a form based off this table. However, it's very difficult to find any particular person from the form unless you happen to know their record number or you just keep pressing the ">" button to display the next record.



    To remedy this, I would like add a search box at the top of the form. I already found this, http://www.databasedev.co.uk/text_search.html, however, since there are multiple people with the same last names, I am forced to search by their SSN# as that's the only unique way of searching any specific person. Searching by SSN# is unfavorable since we don't want to say anyone's SSN# over the phone or aloud.

    Is there any way to create a searchbox that will display "suggestions" underneath it as you type? Like, how when you type into Google Search, it has suggestions right under the text box. So, if I were to type "S", I might see:

    Saddle, Michael E
    Scribble, David I
    Smith, Alfred D.
    Smith, Donald I
    Smith, Tiffany R
    Topper, Allen U

    And, if I were go further and type "Sm", then the suggestions would change on-the-fly to:

    Smith, Alfred D
    Smith, Donald I
    Smith, Tiffany R

    I hope that makes sense.

  2. #2
    cnstarz is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    31
    I found this article which is pretty much exactly what I'm looking for. However, whenever I click on a record that has the same Last Name as someone else, the form will only display the first record of that last name. I have to manually skip records in order to get to other records with the same last name. Anyone know how to modify so that when I click on a record, it'll go to the one that matches the SSN# of the one I'm clicking?

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,046
    Hi,

    if you right click in the control box, the form will show a shortcut menu with a lot of possibilities. Playing with the build-in filters gives a lot of search possibibiloities without having to program one single module.

    grNG

  4. #4
    cnstarz is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    31
    I looked throughout the properties of the listbox, but i didn't see anything that would affect which record to display. I'm pretty sure there's some code I have to change.

    Here's what I have for when you type in the Seach Box. The search box is named "SearchName" and the list box is called "SearchNameList":

    Code:
    Private Sub SearchName_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Last] = '" & Me![SearchNameList] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    Code:
     
    Private Sub SearchName_Change()
        SearchRecordset Me.SearchName, _
         Me.SearchNameList, "Last"
    End Sub
    Code:
     
    Private Sub SearchName_Exit(Cancel As Integer)
        UpdateSearch Me.SearchName, Me.SearchNameList
    End Sub
    Code:
     
    Private Sub SearchNameList_AfterUpdate()
        UpdateSearch Me.SearchName, Me.SearchNameList
    End Sub
    Code:
     
    Private Sub SearchNameList_Click()
        DoCmd.ShowAllRecords
        DoCmd.GoToControl ("Last")
        DoCmd.FindRecord Me!SearchNameList
    End Sub
    "Last" is the Last Name column I have. I have a column for SSN#'s called "SSAN". I would like it so that when you click on a record in the listbox, it displays the record based on SSN#, not Last Name. I attached my sample database so you can see what I'm talking about.

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

Similar Threads

  1. Creating the "inverse" of a table
    By RobF in forum Queries
    Replies: 7
    Last Post: 05-04-2010, 02:50 PM
  2. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  3. Replies: 3
    Last Post: 02-23-2010, 06:32 PM
  4. Creating "Edit Record" link in table column
    By joshearl in forum Forms
    Replies: 1
    Last Post: 12-25-2009, 11:17 AM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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