[AccessD] Change both subform sourceobject and recordsource

Bruce Bruen bbruen at bigpond.com
Mon May 26 21:47:23 CDT 2003


Dear List,

I have a form that contains a changeable subform.  That is, the source
object of the subform is set on the fly by an option group button on the
main form. This works fine, the correct subform pops up as required.

Now I have a situation where one of the subforms (it's a generic list)
could be re-used for different record sources.  That is sometimes it
should list tblA, sometimes tblB, again dependent on which button the
user clicks.  The record sources are completely different, I cant use
filters.

My problem is how do I get the for to know which record source to use?
Normally, I would use an openargs value to achieve this, but as I'm
"opening" the form using a source object switch.

Some code may illustrate

Private Sub grpMain_Click()
    Select Case Me.grpMain
        Case 1: Me.subMain.SourceObject = "frmLoadLog"
        Case 2: Me.subMain.SourceObject = "frmReviewLoad"
        Case 3: Me.subMain.SourceObject = "frmActive1"
        Case 4: Me.subMain.SourceObject = "frmActive1"
        Case 9: DoCmd.Close
    End Select
End Sub

My problem is with case 4.  This is the subform I want to reuse.  
My mind has gone completely blank on this (some would say "small
change"). I just cannot see how I can send frmActive1 some sort of
indicator to change its record source from tblA to tblB.

Any thoughts?

Bruce



More information about the AccessD mailing list