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

Combo box or command button controlling subform data

Status
Not open for further replies.

JimboSHU

Technical User
Dec 23, 2002
15
0
0
US
Basically my question is how can I control which of the several querys i have created appear in a subform by either a selection in a combobox or by a series of different command buttons. Thanks in advance. More or less choosing what form/query appears in the subform
 
Use the AfterUpdate event of the combo box. Then, use something like the following to change the control source. Hopefully, if its simple, the queries are of the same table.

Me.subform.form.Rowsource= Myquery

That's it!

Gary
gwinn7
A+, N+, I+
 
The queries are querying different tables, would that make a difference? I didn't think that would really matter in terms of what I was trying to do.And wouldn't me.subform.rowsource = combobox selection somehow which I could make a table of the names of the actual queries. You know what I mean?
 
I think I screwed up in describing what I want...maybe it's not a subform after all. What I really want is basically the query table to be embedded in the form somehow and by a selection pick which one i want to view.
 
If you want to view the contents of a table through a form, you have to first decide how you want the data presented. There are a few of different ways to go about that (i.e. Datasheet view, list box, or standard data bound controls, etc.).

The form's "Rowsource" property needs to be set to an SQL text or query that you construct. You can set the Rowsource of the form on the fly. If you want to view different tables that have diverse field names, then you could create a subform that is in datasheet view and use a combobox to allow the user to select the table. The list of tables you can obtain from the MSysOBects system/hidden table.

Gary
gwinn7n
A+, N+, I+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top