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

Pulling Table Information into a form

Status
Not open for further replies.

airbus2

Technical User
Apr 16, 2008
31
US
What are the right steps to pull a single employees info (location, e-mail, phone, etc.) into a form thats based on entering an employee number into a currently unbound field. Once I get that down, I then need to pull info into a subform. I read thread702-1459007, but got confused. HELP!
 
Why are you using unbound forms? There are several ways you could do this, but the simplest is to bind the form to the employees table and use a combobox to find a record based on the number entered. There is a wizard that will create the combo for you. It would also be possible to pull one record at a time. Binding the main form to a recordset will also simplify the subform, in that you can use link child and master fields to match the subform data to the main form.

Alternatives include DlookUp, which can be slow, and using a recordset to fill in the fields.
 
Thanks for the response.
The form itself (currently with three tabs)serves as a multi-purpose resourece and first step to access other forms, reports, etc. The employee information is on one tab of the three. Within that tab is the employee info as well as the subform for the badge info.

Did that make it clear as mud? So am I on the right path or should I go a different direction?
 
The problem is that there are a number of answers, so it is very much a case of deciding how you would like this to work. If you would like the user to be able to navigate through the records and to search using the various controls available in Access, a bound recordset containing all employees is the answer. If you would like to limit the employees available to the user, you can create a recordset containing just the requested employee. An SQL string can be used to change the recordset that the form is based on at any stage:

Code:
strSQL="SELECT A, B, C FROM tblEmployees WHERE ID=" & Me.txtID
Me.RecordSource =  strSQL

Have you seen the Northwind sample database that ships with every version of Access? It has a number of useful features and also serves as a basis for discussion.
 
Hi airbus2,

Try something like this:

faq702-6917

if you want you can double click the result and display it on a different form to edit, with a small bit more code.
 
How are ya airbus2 . . .

So you understand [blue]etiquette[/blue] here at [blue]Tek-Tips Forums[/blue], be sure to go over at least one of the links at the bottom of my post! [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top