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

Linking a query to a table?

Status
Not open for further replies.

zephaerie

Technical User
Feb 10, 2004
10
0
0
US
Ok. Here's the deal.
I set up two tables in my db, one to supply information to the other. Three fields in the tables are linked. They are: Engineer, LPE and TM.
In the form I set up for the large database (WSR), I know that I can do a query from the smaller database (E) and have the information relayed to one field. Since E has three columns, I can use that one field three times to display all of the information from the query.
What I don't know is if it's possible to display the information from the three columns of the query into the three fields in the table, which is what I need.
The purpose of this is to be able to choose from a list of Engineers, and have the corresponding LPE and TM show up automatically. This result is produced from the first situation (using one control field from the table for three fields of information on the form), but I haven't been able to figure out how to get the LPE and TM information back to the corresponding fields in the table from the form/query.
 
Good afternoon, if I understand you correctly, you want to select from a combe box an engineer and have that diplay two textboxes of info about the engineer which is stored in a table. Is that about what you are trying to accomplish? Can I assume that this is just displayed data? If so, just use DLookUp in the two text boxes. The textboxes should be unbound and in the source of the property put something like this:
=DLookUp("[CategoryDescription]","[tblCategoryCodes]","[CategoryNumber]='" & [Forms]![frmECNMasterData400]![CategoryNumber] & "'")
This is looking up a category description from a table and displaying it on a form. I think it is pretty much what you are after. Just substitute your field names and table name of for mine and go for it. If this isn't what you are after, there is another way of doing it but this is the easiest way. Good luck hope this works out for you.
 
Thank you, Quest, for your input. That's a different way of doing what I've done in the form. However, where I'm trying to display the data is in the actual table, so that a person could query from the larger table on the two displayed fields (TM & LPE) for reports and the like. As the form is (similar to the situation you described), I cannot query from TM & LPE, because the data is only displayed in the form, and not entered into the table.
 
Zephaerie, DLookUp uses the actual data in the table, it can also be used in a report, just change the destination form to the destination report, in the procedure I pasted.
There is a lot of info in the posts here about DLookUp, I think once you have tried it you will like it, I used it alot on the form in my dbase, I also used it in the reports that I printed off of the form., I am even using it to lookup data in a SQL dbase in a different computer thru ODBC. It may not be perfect but it works, and it works quick and easy. Hope this helps, try playing with it. Good luck and have a good night.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top