Results 1 to 2 of 2
  1. #1
    dibblejon is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Feb 2010
    Posts
    3

    Search 17,000 records

    Hi



    I need to provide a search text box on my form that searches a query when a user enters the customers account number (which is a string field). I had used a combo box but the query ran very slowly across our network - the query has 17,000 records and is indexed.

    I am new to Access and have been having some problems getting my button to work. My broken code is below - currently if you run this I get the error "You can't reference a property or method for a control unless the control has the focus".

    Can someone provide me with some code that would a) work and b) run quickly?

    Code:
    Private Sub cmdFilter_Click()
        If Not IsNull(Me.txtFindAccount.Text) Then
            strWhere = strWhere & "([qry.Customers].ACCOUNT = """ & Me.txtFindAccount.Text & """) AND "
            End If
    End Sub
    Any help would be greatly appreciated.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    One issue is the .Text property is only usable when the control has the focus. Use the .Value property instead which does not have this restriction. As for the speed of the query, 17,000 records is basically nothing. Your speed issue is elsewhere. This link might offer some suggestions. http://www.granite.ab.ca/access/performancefaq.htm

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

Similar Threads

  1. Search for multiple records
    By Blake in forum Queries
    Replies: 1
    Last Post: 08-23-2013, 03:17 AM
  2. search function
    By Eric1066 in forum Access
    Replies: 0
    Last Post: 10-23-2009, 10:23 AM
  3. Search
    By DWS in forum Forms
    Replies: 3
    Last Post: 08-24-2009, 12:07 PM
  4. Recalling Records from a Combo search
    By Dreamcatcher in forum Forms
    Replies: 0
    Last Post: 08-18-2008, 07:33 AM
  5. Search All Field
    By robbiebrown34 in forum Access
    Replies: 0
    Last Post: 05-17-2007, 09:40 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