By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

I am building a search form

P: 1
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.
Mar 8 '08 #1
Share this Question
Share on Google+
4 Replies


puppydogbuddy
Expert 100+
P: 1,923
Here is a link to a "How To" that includes a downloadable demo with the source code.

http://www.databasedev.co.uk/list_box_searching.html
Mar 8 '08 #2

lee123
100+
P: 556
Or you could do this to find a certain name:

Expand|Select|Wrap|Line Numbers
  1. private Sub Text1_Afterupdate()
  2.  
  3.      Dim search As String
  4.      Search = Text1
  5.      If search = "" or IsNull(search) Then Exit Sub
  6.      Docmd.GoToControl "What Ever your Field Is"
  7.      DoCmd. FindRecord Search, Acanywhere, False, Acsearchall, , accurrent, True
  8.      Me.Refresh
  9.  
  10. End Sub
lee123
Mar 8 '08 #3

Scott Price
Expert 100+
P: 1,384
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
Mar 8 '08 #4

lee123
100+
P: 556
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
Mar 8 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.