B
Bill
I have a report opened via a DoCmd.OpenReport in
acViewPreview mode with arguments. In OnOpen code
sheet I have:
******************************begin
code**************************************************************
Private Sub Report_Open(Cancel As Integer)
Dim Arg() As String
Dim PicFile As String
Const ImageName = "ProgOutsideFront.jpg"
'========================================================================================'
' Openargs contains two arguments separated by a semicolon. The first is the
folder name
' of the folder containing the jpg file of the front cover image. The second
argument is
' the formated date of the next performance of the form: month day, year
'========================================================================================'
Arg = Split(OpenArgs, ";") ' Break OpenArgs into its
two components
PicFile = "C:\GAP\" & Arg(0) & "\" & ImageName ' Format fully qualified
image file name
If Dir(PicFile) = ImageName Then ' Check to see if file
exists.
Me.FrontImage.Picture = PicFile ' Assign that to image
control for linking
Me.LBL_NextPerf.Caption = Arg(1) ' Next perf date also on
back of booklet
Arg = Split(Me.LBL_NextPerf.Caption, " ") ' Strip off the month name
Me.LBLConcertFor.Caption = "Concert For " & Arg(0) ' Month also
appears on back
Else
MsgBox "The image file " & PicFile & " does not exist."
Exit Sub
End If
End Sub
***************************************end
code******************************************************
In my testing, I purposely ran a case where the required file
was missing. I did in fact get the MsgBox message, but
the report previewed anyway, rather than exit the report.
Is there something peculiar about the code running in
preview mode? I.e., the report continued minus the
image that would otherwise be included in the report.
Bill
acViewPreview mode with arguments. In OnOpen code
sheet I have:
******************************begin
code**************************************************************
Private Sub Report_Open(Cancel As Integer)
Dim Arg() As String
Dim PicFile As String
Const ImageName = "ProgOutsideFront.jpg"
'========================================================================================'
' Openargs contains two arguments separated by a semicolon. The first is the
folder name
' of the folder containing the jpg file of the front cover image. The second
argument is
' the formated date of the next performance of the form: month day, year
'========================================================================================'
Arg = Split(OpenArgs, ";") ' Break OpenArgs into its
two components
PicFile = "C:\GAP\" & Arg(0) & "\" & ImageName ' Format fully qualified
image file name
If Dir(PicFile) = ImageName Then ' Check to see if file
exists.
Me.FrontImage.Picture = PicFile ' Assign that to image
control for linking
Me.LBL_NextPerf.Caption = Arg(1) ' Next perf date also on
back of booklet
Arg = Split(Me.LBL_NextPerf.Caption, " ") ' Strip off the month name
Me.LBLConcertFor.Caption = "Concert For " & Arg(0) ' Month also
appears on back
Else
MsgBox "The image file " & PicFile & " does not exist."
Exit Sub
End If
End Sub
***************************************end
code******************************************************
In my testing, I purposely ran a case where the required file
was missing. I did in fact get the MsgBox message, but
the report previewed anyway, rather than exit the report.
Is there something peculiar about the code running in
preview mode? I.e., the report continued minus the
image that would otherwise be included in the report.
Bill