Results 1 to 8 of 8
  1. #1
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81

    Text Box Search Having Issue Finding Name of Clinic

    I have an unbound textbox (txtFilter) in the header of a form that is being used to show a specific record in the form. The user types in part or all of the name of the Clinic and it will go to that record.



    Here is my issue:
    One of the clinic names is First In Health. If the user types in 'Firs' and then hits enter, it finds First In Health perfectly. If the user types in 'First', it goes to the next record. If the user types in 'first i', it works. If the user types in 'first in', it doesn't. See what I mean? I can see what is happening, I just don't know how to fix it.


    Code:
            Set rs = Me.Recordset.Clone        rs.FindFirst "([ClinicName] > """ & Me.txtFilter & "*"")"
            If Not rs.EOF Then Me.Bookmark = rs.Bookmark

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Try changing: rs.FindFirst "([ClinicName] > """ & Me.txtFilter & "*"")"
    to:
    rs.FindFirst "([ClinicName] Like '*" & Me.txtFilter & "*'")"

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Why not use a combo box instead of a text box.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    Quote Originally Posted by jwhite View Post
    Try changing: rs.FindFirst "([ClinicName] > """ & Me.txtFilter & "*"")"
    to:
    rs.FindFirst "([ClinicName] Like '*" & Me.txtFilter & "*'")"
    That works as long as the user types in part of a name that exists. If they mistype and add a letter or something, it goes to the first record. I would like it to go to the next record so the user can then use arrows to find what they may be looking for.

  5. #5
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    Quote Originally Posted by Bob Fitz View Post
    Why not use a combo box instead of a text box.
    That would work, but I am only showing a small part of my code. I actually have a combobox that somewhat controls the textbox. In the first combobox, the user can choose what they want to search for in the form. Then when they type something into the textbox, it looks at what is selected in the combobox to determine how it should search.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    How about:
    Code:
            Set rs = Me.Recordset.Clone        
            rs.FindFirst "([ClinicName] >= """ & Me.txtFilter & "*"")"
            If Not rs.EOF Then Me.Bookmark = rs.Bookmark

  7. #7
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You maybe could make use of the OnChange event and apply a filter to the form. As the user types, the filter is modified for each keystroke. If they type a invalid character combination, the records disappear. As long as the underlying record source is not huge or you're not going over a network as you filter, performance should be acceptable.
    Maybe that's not conducive to what you're trying to do anyway. Just thought I'd throw it in here.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    Thank you everyone. I'll keep plugging away and trying different things.

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

Similar Threads

  1. Replies: 11
    Last Post: 10-28-2014, 01:24 PM
  2. Text Box Only Finding Records with Exact Text
    By dannybeaver in forum Access
    Replies: 5
    Last Post: 09-11-2014, 07:38 AM
  3. Replies: 3
    Last Post: 08-22-2012, 03:51 PM
  4. USG Clinic exam system: Changing User
    By isnpms in forum Access
    Replies: 2
    Last Post: 08-22-2010, 07:31 PM
  5. clinic database
    By jeanmhealy in forum Database Design
    Replies: 2
    Last Post: 08-22-2010, 10:08 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