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!

Using a Combo Box to Drive Queries...

Status
Not open for further replies.

1LongShot

Technical User
Dec 29, 2004
8
US
I've got a combo box that runs a query based on the record the user selects.

DoCmd.OpenQuery Me.comboComponentType.Column(4)

The query name is in the fourth column of the table. I'd like a subreport to show the results if the query selected. All the queries will have a similar output. How do I get the subreport to use the selected query as the data source?

Better yet, how can I get the combo box to construct a custom query using the fields in the combo box's associated table (ie. Select [me.combobox.column(1)]...etc.), and then show the results of the query on the form in a subreport?

Thanks in advance.
 
I thought perhaps I'd clarify what I'm up to. I've got two nearly identical tables for each component category in a construction project. (I know, I know, no need to start yelling, I have my reasons) One table is a working table that engineers use to spec components. The twin to that table is an AutoCad XData register that tracks components that are ACTUALLY in a drawing. Every so often, the engineer will fire up an update form, select his component category and a query will run, showing him/her the TAG_'s of components that are both in a drawing and in the working table. A second query will be run to move needed data field values from the working table to the drawing table. What I'd like to see is this:

1. User selects a component category fron the combo box. This triggers a (ON UPDADTE) query that gets it's table names from record selected in the combo box. The FIELDS ARE ALWAYS THE SAME, just different tables are referenced.

2. The query shows it's results in a subreport on the form.

3. After the matching Tag #'s and their descriptions are reviewed, the engineer will select a command button to run a second query (an update) that moves data from one table to another. Again, THE FIELDS NEVER CHANGE IN THIS QUERY. Just the table names, again based upon the selection of the combo box record.

Again, many thanks for any help.

Owen Whitehouse
Broin & Associates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top