Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search button?

Status
Not open for further replies.
Dec 17, 2003
39
US
I have a form that has the information for about 500 employees indexed by their employee ID. The user wants to be able to click a button and enter only the Employee ID and their information is filtered into the form. Can anyone help me?
 
Easiest way would be to put this in the Click() event:

Me.EmployeeID.SetFocus
SendKeys "{^f}"

Other possibility would be via a recordset. Add a text field where to enter the EmpID (lets call it srchID for the moment), then in the click event of the button:

Dim rs as Recordset
set rs= me.recordsetclone
rs.FindFirst Me!srchText
Me.bookmark=rs.bookmark
rs.close

Greetings,
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Hi,

You have to create a botton with wizard.
and on the wizard you can selected Find record and make finish the wizard.

it's will be usefull for you

ali
af1112@yahoo.com
 
thanks for the responses, but i'm not looking for the find button. I've trying to sort through records using the employee's iD???????
 
If I got you right, you want to create your own Find button. Correct?
In that case use the second possibility I offered, the recordset.

Greetings,
MakeItSO

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
If I understand your question correctly you have a form based on a table containing about 500 records. The primary key of the table is the ID number and you want to bring that record current on the form by entering the ID number on the form and then clicking a FIND button.

What I would do is place an unbound text box on the form with the caption "Enter employee ID." Somewhere else on the form should be another text box that displays the ID number and is bound to the field on the table. There will be other text boxes displaying other record information such as name, etc.

Say the bound text box is named "EmployeeID" and the unbound text box is named "PickEmployee." In the GotFocus event of the PickEmployee place the following code:

Me!PickEmployee = Null

This will blank the text box whenever the cursor is placed there. In the AfterUpdate event of the same field place the following code:

Me!EmployeeID.SetFocus
DoCmd.FindRecord Me!PickEmployee

This will set the cursor to the EmployeeID text box and then locate the record that matches the ID number entered into the PickEmployee box. The other information relating to that employee will then be displayed on the form.

Hope this works for you.
AvGuy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top