RE: On Close
- From: benj <benj@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Dec 2006 21:28:01 -0800
I tried placing the code in the On Open event:
Private Sub Report_Open(Cancel As Integer)
if [Forms]![FM_MAIN]![Age] = "Yes" then
me.elisaSUB.SourceObject = "subreport1"
else
me.elisaSUB.SourceObject = "subreport2"
end if
exit sub
But am getting the error 2450: can't find 'FM_MAIN' refered to in a VB code.
I actually seeked help regarding this but didnt get any reply (Changing
source object: Dec 10, 2006 and Source Object in Subreport: Dec 5, 2006).
The FM_MAIN form is open (where the preview icon is located)
Thanks Duane!
"Duane Hookom" wrote:
You can change the subreport source object in the On Open event of the.
report. This can be done without opening in design view.
--
Duane Hookom
Microsoft Access MVP
"benj" wrote:
the preview command button will open the report in design view first, then it
will load the desired subreport then open it in preview mode. It makes
changes in the subreports Source Object so am being promted when closing. I
dont want to make changes or be prompted to. The shortened code is:
Private Sub Command184_Click()
On Error GoTo Err_Command184_Click
Dim stDocName As String
DoCmd.OpenReport "RF_elisa", acViewDesign
If Me.Age = "Yes" Then
[Reports]![RF_elisa1]![elisaSUB].SourceObject =
"RF_elisa_ext1"
Else: [Reports]![RF_elisa1]![elisaSUB].SourceObject =
"RF_elisa_ext2"
End If
stDocName = "RF_elisa1"
DoCmd.OpenReport stDocName, acPreview
Exit_Command184_Click:
Exit Sub
Err_Command184_Click:
MsgBox Err.Description
Resume Exit_Command184_Click
End Sub
Thanks!
"Duane Hookom" wrote:
Are you opening your report in design view? I haven't been normally been
prompted to save when I have made changes to properties in preview or print
modes.
--
Duane Hookom
Microsoft Access MVP
"benj" wrote:
Good day!
What code can i place "On Close" event (or in any event) that will close the
report without saving? I have created a report that has a changing
Subreports' SourceObject. Everytime i would close the report, save message
appears. I dont want the message to appear nor to save the report.
- Follow-Ups:
- RE: On Close
- From: Duane Hookom
- RE: On Close
- Prev by Date: Re: Passing info to a report from a form
- Next by Date: Re: using large amounts of text in reports
- Previous by thread: RE: Report Examples
- Next by thread: RE: On Close
- Index(es):