Charlotte Foust
cfoust at infostatsystems.com
Thu Jun 3 10:41:09 CDT 2004
Rocky, The subreport isn't open in the same sense the parent report is, so your routine is going to bomb because the subreport won't show up in the reports collection. I usually pass an object instead of a string in situations like this, which avoids the problem because the object already exists and doesn't have to be instantiated properly. You can pass Me from the subreport into the function and have it work without problems. Charlotte Foust -----Original Message----- From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] Sent: Thursday, June 03, 2004 7:34 AM To: AccessD at databaseadvisors.com Subject: [AccessD] Set Report Format Dear List: I am trying to set a variable rpt to a sub report in a Public function (this is for purposes of translating the labels to a foreign language). I am passing the report name to the function in the Report_Open event. Setting it to the Main report is no problem. Public Function TranslateControlReport(argReport As String) As Boolean Dim rpt As Report Set rpt = Reports(argReport) works fine. But in the _Open event of the sub-report when I pass the name of the sub-report to this routine I get a run time error 2451 - the report name you entered is misspelled or refers to a report that isn't open or doesn't exist. I think it has to do with the fact that I'm only passing the sub-report name and have to qualify it with the Main report? But I've tried several syntaxes with no luck. Anybody know? MTIA Rocky Smolin Beach Access Software http://www.e-z-mrp.com But -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com