I have a form which previews a report at the end by clicking a command button. I need the report being previewed to be determined by a choice during completion of the form.
Example:
If Brand = Harris Flotebote
Report to Preview = rpt_WindowSticker
If Brand - Nautic Star
Report to Preview = rpt_WindowSticker_NauticStar
The event procedure was working great when I had only one Window Sticker report. But now that I am needing a different report to preview (and ultimately print) for each different brand, I am experiencing a problem.
I am not getting an error from my event procedure. Presently when I click the Preview Window Sticker button at the end of the form, nothing happens. But I don't receive any errors.
Event Procedure -
Private Sub cmdView_Click()
On Error GoTo ErrorHandler
DoCmd.RunCommand acCmdSaveRecord
Select Case Brand 'Evaluate Brand
Case "Harris_Flotebote"
DoCmd.OpenReport ReportName:="rpt_WindowSticker", _
View:=acViewPreview, _
WhereCondition:="ID=" & Me!ID
Case "Nautic_Star"
DoCmd.OpenReport ReportName:="rpt_WindowSticker_NauticStar", _
View:=acViewPreview, _
WhereCondition:="ID=" & Me!ID
End Select
ExitProcedure:
Exit Sub
ErrorHandler:
Select Case Err.Number
Case Else
MsgBox "Error # " & Err.Number & ": " & Err.Description, vbOKOnly + vbExclamation, "Unexpected Error"
End Select
Resume ExitProcedure
End Sub
Please help if you can.
Barbara
Example:
If Brand = Harris Flotebote
Report to Preview = rpt_WindowSticker
If Brand - Nautic Star
Report to Preview = rpt_WindowSticker_NauticStar
The event procedure was working great when I had only one Window Sticker report. But now that I am needing a different report to preview (and ultimately print) for each different brand, I am experiencing a problem.
I am not getting an error from my event procedure. Presently when I click the Preview Window Sticker button at the end of the form, nothing happens. But I don't receive any errors.
Event Procedure -
Private Sub cmdView_Click()
On Error GoTo ErrorHandler
DoCmd.RunCommand acCmdSaveRecord
Select Case Brand 'Evaluate Brand
Case "Harris_Flotebote"
DoCmd.OpenReport ReportName:="rpt_WindowSticker", _
View:=acViewPreview, _
WhereCondition:="ID=" & Me!ID
Case "Nautic_Star"
DoCmd.OpenReport ReportName:="rpt_WindowSticker_NauticStar", _
View:=acViewPreview, _
WhereCondition:="ID=" & Me!ID
End Select
ExitProcedure:
Exit Sub
ErrorHandler:
Select Case Err.Number
Case Else
MsgBox "Error # " & Err.Number & ": " & Err.Description, vbOKOnly + vbExclamation, "Unexpected Error"
End Select
Resume ExitProcedure
End Sub
Please help if you can.
Barbara