[AccessD] Setting Sub Report Recordsource via VBA

Dan Waters dwaters at usinternet.com
Tue Jun 1 15:25:06 CDT 2004


Jeff,

What a coincidence.  

I've been working on this exact problem for the last 3 hours.  I finally
found a note in Help for SourceObject.  It says that SourceObject cannot be
set or changed during a report's Open or Format events (but I know this does
work for Forms).  I couldn't get it to work under any of the report's
events.

Because I couldn't set the SourceObject of the subreport, I assume that you
are also unable to set the recordsource.

I now writing code to open the report in Design view, make the changes,
close the report (save = yes), and then reopen in normal view.

Well - that's what I know.

Dan Waters

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
jeffrey.demulling at usbank.com
Sent: Tuesday, June 01, 2004 2:51 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Setting Sub Report Recordsource via VBA





I am trying to set a subreport's recordsource via a VBA and cannot seem to
get it correct.

I have tried:

me.<<subreportname>>.Recordsource = finalsqltext

Reports!<<parentreportname>>!<<subreportname>>.Recordsource = finalsqltext

and neither one seems to be working.

Can anyone help????


-- 
_______________________________________________
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