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

Subform help, really simple!!

Status
Not open for further replies.

jon182

Technical User
Feb 7, 2002
18
GB
Hiya

At the moment i have 4 queries, i can use the subform to view the contents of one query in a form, right clicking on the subform in design view and selecting properties, then source object the following is shown.

query.BS12 4FL

BS12 4FL is the name of my query
How do i use the same form to view the result of another query.
Please help
Jon
 
If you click on the record source field you will see a drop-down window that will allow you to select a different record source - the list should include your other queries.
 
thanks for reply
yes but doing it that way only allows me to select one query at a time, i want to view multiple queries in the subform
 
jon182: Sounds like you want to change your queries, perhaps at run time? The best way I have found to do that is to create a subform, say, MySubForm, and change its Source Object at run time. You could put in a combo box and on the AfterUpdate Event have something like:

If (Me![cboMyBox] = "A") Then
Forms![MyForm].Form![MySubForm].SourceObject = "frmMySubFormA"
Forms![MyForm].Form![MySubForm].Requery
Exit Sub
ElseIf (Me![cboMyBox] = "B") Then
Forms![MyForm].Form![MySubForm].SourceObject = "frmMySubFormB"
Forms![MyForm].Form![MySubForm].Requery
Exit Sub
.....
.....
Exit Sub
End If

You would have to create datasheet forms for each subform called. I have had problems, maybe some one can help here, changing the "query" (RecordSource) of a subform at run time; so I default to just changing the "Source Object" upon some event. In your case it would be the updating of the combo box.
 
ok sounds promising!! ill give it a go

thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top