Multiple Query's on a single sub form?

rsmonkey

Registered User.
Local time
Today, 02:57
Joined
Aug 14, 2006
Messages
297
Is it possible to display specific Query's in a single subform dependant on a combobox selection? If so how wud i go about doing this?

Any help is much appreciated. Thanx
 
Yes, you set the subform's recordset to the applicable query in the after update event of the combo box and then make sure to do a requery, which I believe should be done as:
Code:
Forms!MyMainFormName.MySubformControlName.Form.Requery

although it could be (I don't have the ability to test at the moment)

Code:
Forms!MyMainFormName.MySubformControlName.Requery
 
This is what I came up

Could not figure out the above but untill we figure it out perhaps this will work for you. The above looks like it might consist of less lines of code but not sure.
 

Attachments

Well I thought I could get it working but I was wrong :( neways if anyone could take a gander at my code and point me in the right direction that would be good..

Code:
Option Compare Database

Private Sub Combo2_AfterUpdate()

Select Case Combo2
Case Is = "AD Account"
Me!SubfrmAssetsUnmatched.Form.RecordSource = "SubqryADUnmatched"
Case Is = "BlackBerry"
Me!SubfrmAssetsUnmatched.Form.RecordSource = "SubqryBBUnmatched"
Case Is = "EAS"
Me!SubfrmAssetsUnmatched.Form.RecordSource = "SubqryEASUnmatched"
Case Is = "RAS"
Me!SubfrmAssetsUnmatched.Form.RecordSource = "SubqryRASUnmatched"
Case Is = "PC/Laptop"
Me!SubfrmAssetsUnmatched.Form.RecordSource = "SubqryPCsUnmatched"
Case Is = "Email Account"
Me!SubfrmAssetsUnmatched.Form.RecordSource = "SubqryEmailAccUnmatched"

End Select



End Sub

Anyhelp is much appreciated!
 
I think you're close, but the syntax is a bit wrong.

Instead of
Code:
Me!SubfrmAssetsUnmatched.Form.RecordSource

use
Code:
Forms!MyMainFormNameHere.SubfrmAssetsUnmatched.Form.RecordSource

When referring to most things on a subform, you need to include the part that identifies which main form it's on.
 

Users who are viewing this thread

Back
Top Bottom