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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating forms (searching fro desired form)

Status
Not open for further replies.

bbannock

Technical User
Oct 24, 2003
30
US
Hi,

I'm creating a database and I have a series of forms and querries already created. One of these forms shows all employee info, and then as a subform lists all of their expenses. I want to create a function so that anyone using the database can type in the employee name or employee number and then can view the data for that specific employee only. Right now I can only navigate through the forms by using the record navigation bar at the bottom of the form. This maybe an easy question, but any help would be great...thanks alot.

Brandon
 
Hi

An easy way to do this, if form is a bound form, which from your description it is

put a combo box on the form (cboEmployeeId), say near the navigation buttons, do not bind the combo box, base the combo box on the employee table and make the columns in the rowsource EmployeeId, EmployeeName (using your own column names for this of course)

In the after update event of the combo put code like so:

Me.RecordsetClone.FindFirst "EmployeeId = " & cboEmployeeId
If Me.RecordsetClone.NoMatch Then
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End if

the above is assuming that EmployeeId is numeric, if it is a string then

Me.RecordsetClone.FindFirst "EmployeeId = '" & cboEmployeeId & "'"
If Me.RecordsetClone.NoMatch Then
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End if






Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thank you so much...everything is working smoothly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top