Setting sub report Record Source

  • Thread starter Thread starter gr
  • Start date Start date
G

gr

Hello all,

I want to set the record source of a subreport on the Open
Event of the main report.
I have a long code in order to get the appropiate Record
source for the sub report (coded on the main report Open
Event). but when trying to set it using the statement

Me.srptSCMaintenance.Report.RecordSource = strRSMaintenance

the following error shows out
Error 2455: You entered an expression that has an invalid
reference to the Form/Report.

By debuging the code I can get what actually is helded by
strRSMaintenance and I think the SQL string is ok.

Debug.Print strRSMaintenance

SELECT qrySuitcaseStatus.MDID,
qrySuitcaseStatus.DeviceName, qrySuitcaseStatus.DeviceID,
qrySuitcaseStatus.SuitcaseID,
qrySuitcaseStatus.ABBSuitcaseID,
qrySuitcaseStatus.ListOfNamesID,
qrySuitcaseStatus.StoragePlace FROM qrySuitcaseStatus
WHERE (qrySuitcaseStatus.MDID Like 19)

I also tried with strRSMaintenance like this with no
success (same error)
SELECT MDID, DeviceName, DeviceID, SuitcaseID,
ABBSuitcaseID, ListOfNamesID, StoragePlace FROM
qrySuitcaseStatus WHERE (qrySuitcaseStatus.MDID Like 19)

What I'm doing wrong?
 
Hi,

You would need to do it on the OnOpen event of the subReport.

SubReport events fire before MainReport events.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights

--------------------
| Content-Class: urn:content-classes:message
| From: "gr" <[email protected]>
| Sender: "gr" <[email protected]>
| Subject: Setting sub report Record Source
| Date: Wed, 21 Jul 2004 06:34:58 -0700
| Lines: 35
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcRvJ4RAb/WRi4YQQBuAklZoGZyBYA==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.reports
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.reports:143151
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.access.reports
|
| Hello all,
|
| I want to set the record source of a subreport on the Open
| Event of the main report.
| I have a long code in order to get the appropiate Record
| source for the sub report (coded on the main report Open
| Event). but when trying to set it using the statement
|
| Me.srptSCMaintenance.Report.RecordSource = strRSMaintenance
|
| the following error shows out
| Error 2455: You entered an expression that has an invalid
| reference to the Form/Report.
|
| By debuging the code I can get what actually is helded by
| strRSMaintenance and I think the SQL string is ok.
|
| Debug.Print strRSMaintenance
|
| SELECT qrySuitcaseStatus.MDID,
| qrySuitcaseStatus.DeviceName, qrySuitcaseStatus.DeviceID,
| qrySuitcaseStatus.SuitcaseID,
| qrySuitcaseStatus.ABBSuitcaseID,
| qrySuitcaseStatus.ListOfNamesID,
| qrySuitcaseStatus.StoragePlace FROM qrySuitcaseStatus
| WHERE (qrySuitcaseStatus.MDID Like 19)
|
| I also tried with strRSMaintenance like this with no
| success (same error)
| SELECT MDID, DeviceName, DeviceID, SuitcaseID,
| ABBSuitcaseID, ListOfNamesID, StoragePlace FROM
| qrySuitcaseStatus WHERE (qrySuitcaseStatus.MDID Like 19)
|
| What I'm doing wrong?
|
|
 
Back
Top