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

More than one Querry as the Record Source of a Form? 1

Status
Not open for further replies.

DJKAOS

Technical User
Jun 30, 2000
101
US
Is it possible to have my form linked up to 2 diffrent querries? if so How can I do this?

I assume it has to do with the 'Record Source' Property of the form, but I can't figure out how to add a second querry to that. I tried separating them with ; and with , or with & and none of them work.

 
hmmm....

Depends.

Do you want the two queries to behave as one table? UNION QUERY

If they are to viewed as seperate entities you should use the subform.

Good Luck




-Pete
 
two seperate.
Well, one querry contains ALL records of a certain type 'A'
the second querry containts only the 10 newest records of type 'A'

I think I will try to do subform, that makes sense I think...its only used for averages anyway.
 
Hi,

One way to do it without a subform, provided you don't need to see both ALL and the 10 newest records simultaneously is you can have an option button to control the view. You can use the same form and simply change its recordsource property with the appropriate query and then requery the form. You can put the code to do it in the option button afterupdate event.

Have a good one!
BK
 
DJKAOS, I think this is what you're after:
You can "run" your form off of any query or SQL string you like. All you need is a way to control it. Here's an example you can work from:

I have an option group that gives me X choices. In its after update event I do this:

Dim strRs as String
Select Case (MyOptionGroup)
Case 1
strRS = "qryA"
Case 2
strRS = "qryB"
End Select
Me.RecordSource = strRs
Me.Requery

You can do this to a saved query as above or to an SQL string. Careful though: Make sure you'll fill all the fields with data to avoid those #Name? things...! Your option group might say "All Records" and "Last 10 Records".

And away you go!
Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top