I am building a search form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NithinR
    New Member
    • Mar 2008
    • 1

    I am building a search form

    I am new to access.
    Please help me...

    I am using access 2000. I have an access form that is bound to the table employees. The employee table has fileds for lastname, firstname, age, etc.

    I want to build a search function on the form. I added a text box and a search button. When the user enters the last name(or part of the last name) in the text box and clicks the search button, I want to display all matching records(many employees have the same last name)..in a list box.

    The user can select the emplyee and that record is loaded on the form.

    Can someone help me with this?

    Please include all code as I am new to access.

    Thanks in advance.
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Here is a link to a "How To" that includes a downloadable demo with the source code.

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      Or you could do this to find a certain name:

      [CODE=vb]private Sub Text1_Afterupda te()

      Dim search As String
      Search = Text1
      If search = "" or IsNull(search) Then Exit Sub
      Docmd.GoToContr ol "What Ever your Field Is"
      DoCmd. FindRecord Search, Acanywhere, False, Acsearchall, , accurrent, True
      Me.Refresh

      End Sub[/CODE]

      lee123
      Last edited by Scott Price; Mar 8 '08, 04:00 PM. Reason: code tags

      Comment

      • Scott Price
        Recognized Expert Top Contributor
        • Jul 2007
        • 1384

        #4
        Lee, thanks for your answer, but could I ask you to use the [CODE] tags provided?

        As a full member, and especially with the number of posts that you have, this is not asking very much! It's quite simple to add them... Simply select your code in the reply window, then click on the # icon on the top of the reply window.

        Thanks!

        Regards,
        Scott

        Comment

        • lee123
          Contributor
          • Feb 2007
          • 556

          #5
          yea sorry i always forget to do that when you see somrthing you can help with it just kida slips your mind sorry scott price

          lee123

          Comment

          Working...