Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    86

    Wink Unanswered: Search a form problem

    I have a form in acess. I have a field called last name. i want to search the whole form for that last name. So if i have 3000 records and i type smith into the last name text box and hit search it will bring me to that record were smith is. ANy thoughts, tips or code?

    Thanks Pete

  2. #2
    Join Date
    Jun 2004
    Posts
    96
    try docmd.findrecord... you can search help for "findrecord", it will give u a better idea.

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    Try using the Filter property for your form


    Code:
    Dim myCriteria As String
    myCriteria = "[LastName] = '" & Me.mySearchTxtBoxName & "'"
    Me.Filter = myCriteria
    Me.FilterOn = True
    Me.Requery
    Assuming that your form RecordSource property is set to the table that holds all the names and the last name field in this table is named LastName. If Smith is enterd into the mySearchTxtBoxName TextBox and the code above is placed into a button beside this TextBox, then your form will populate with all the records of people that have the last name Smith.

    Or just use: DoCmd.RunSQL mySQLString


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •