<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><STRONG>Bruce,</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV> Let MySF be the name of SubForm control, "MyForm" the
name of form serving as source object for MySF and "MyQ" the name of saved
query or table serving as record source for "MyForm". You could try the
following code (from the parent form) -</DIV>
<DIV> </DIV>
<DIV> MySF.SourceObject = "MyForm"<BR>
MySF.Form.RecordSource = "MyQ"</DIV>
<DIV> </DIV>
<DIV> This will effect the desired changes at run time.</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV><STRONG>A.D.Tejpal</STRONG></DIV>
<DIV><STRONG>--------------</STRONG></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=michael.mattys@adelphia.net
href="mailto:michael.mattys@adelphia.net">Michael R Mattys</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, May 27, 2003 08:44</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [AccessD] Change both
subform sourceobject and recordsource</DIV>
<DIV><BR></DIV>Hi Bruce,<BR><BR>Unless someone knows better ...<BR>It looks
like you'd have to open the source object<BR>in design view (hidden) and set
it's recordsource,<BR>save it, and then open it in the main
form.<BR><BR>Michael R. Mattys<BR><A
href="http://www.mattysconsulting.com">www.mattysconsulting.com</A><BR><BR>-----
Original Message ----- <BR>From: "Bruce Bruen" <<A
href="mailto:bbruen@bigpond.com">bbruen@bigpond.com</A>><BR>To: <<A
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>><BR>Sent:
Monday, May 26, 2003 10:47 PM<BR>Subject: [AccessD] Change both subform
sourceobject and recordsource<BR><BR><BR>> Dear List,<BR>> <BR>> I
have a form that contains a changeable subform. That is, the
source<BR>> object of the subform is set on the fly by an option group
button on the<BR>> main form. This works fine, the correct subform pops up
as required.<BR>> <BR>> Now I have a situation where one of the subforms
(it's a generic list)<BR>> could be re-used for different record
sources. That is sometimes it<BR>> should list tblA, sometimes tblB,
again dependent on which button the<BR>> user clicks. The record
sources are completely different, I cant use<BR>> filters.<BR>> <BR>>
My problem is how do I get the for to know which record source to use?<BR>>
Normally, I would use an openargs value to achieve this, but as I'm<BR>>
"opening" the form using a source object switch.<BR>> <BR>> Some code
may illustrate<BR>> <BR>> Private Sub
grpMain_Click()<BR>> Select Case
Me.grpMain<BR>> Case 1:
Me.subMain.SourceObject =
"frmLoadLog"<BR>> Case 2:
Me.subMain.SourceObject =
"frmReviewLoad"<BR>> Case
3: Me.subMain.SourceObject =
"frmActive1"<BR>> Case 4:
Me.subMain.SourceObject =
"frmActive1"<BR>> Case 9:
DoCmd.Close<BR>> End Select<BR>> End Sub<BR>>
<BR>> My problem is with case 4. This is the subform I want to
reuse. <BR>> My mind has gone completely blank on this (some would
say "small<BR>> change"). I just cannot see how I can send frmActive1 some
sort of<BR>> indicator to change its record source from tblA to
tblB.<BR>> <BR>> Any thoughts?<BR>> <BR>>
Bruce<BR></BLOCKQUOTE></BODY></HTML>