Results 1 to 4 of 4
  1. #1
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150

    Dynamic Search in Form

    I have a continuous form that I would like to the result being refreshed using me.form.requery upon each character is entered in a textbox. I'm using the two textbox technique where one is invisble.
    txtItemSearch is the textbox user enters for search. txtSrchItemText is the invisible textbox. This event works fine until a space is entered. I then get "You can't reference a property or method for a control unless the control has the focus" error.

    Below is what I have
    Code:
       
    Private Sub txtItemSearch_Change()
        Dim vSearchString As String
        Me.txtItemSearch.SetFocus
        vSearchString = Nz(Me.txtItemSearch.Text)
        txtSrchItemText.Value = vSearchString
        Me.Form.Requery
        Me.txtItemSearch.SetFocus
        Me.txtItemSearch.SelStart = Me.txtItemSearch.SelLength
    
    
    End Sub
    How do I resolve this issue?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    refreshing after EVERY character is too much.
    you cant wait until he whole word is finished?

  3. #3
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    Quote Originally Posted by ranman256 View Post
    refreshing after EVERY character is too much.
    you cant wait until he whole word is finished?
    My thought is that once they find something they're searching for, they can stop typing.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If you must 'find as you type', review http://allenbrowne.com/AppFindAsUType.html

    I am guessing Allen deals with space, but never used so can't say for sure.
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-06-2014, 05:37 PM
  2. Replies: 1
    Last Post: 03-26-2014, 03:38 PM
  3. Simple Dynamic Client Search
    By Lorne in forum Forms
    Replies: 4
    Last Post: 12-21-2011, 04:58 PM
  4. Creating a dynamic search box in Access 2010
    By bob500000 in forum Access
    Replies: 1
    Last Post: 11-24-2011, 02:27 PM
  5. Dynamic Form, Dynamic labels/ captions?
    By JFo in forum Programming
    Replies: 15
    Last Post: 10-12-2011, 08:33 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