[AccessD] Change both subform sourceobject and recordsource

Michael R Mattys michael.mattys at adelphia.net
Mon May 26 22:14:19 CDT 2003


Hi Bruce,

Unless someone knows better ...
It looks like you'd have to open the source object
in design view (hidden) and set it's recordsource,
save it, and then open it in the main form.

Michael R. Mattys
www.mattysconsulting.com

----- Original Message ----- 
From: "Bruce Bruen" <bbruen at bigpond.com>
To: <accessd at databaseadvisors.com>
Sent: Monday, May 26, 2003 10:47 PM
Subject: [AccessD] Change both subform sourceobject and recordsource


> 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
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 


More information about the AccessD mailing list