Y
yoda jedi
I have 3 reports to run via one report. Basically, the users don't
want the interface changed. BUT for companies A and B, they want
changed reports. So I created reports A and B, respectively.
So I wrote the code to, if companies A or B were selected, close the
current report (which is for all other companies), and open reports A
or B.
[This is SORT of a solution, because when they ask to print a report,
they can only get a print preview of A or B, and the original report
prints out on the printer. Think of it as one report routing to
itself, A or B, depending on the selection of company.]
But nevermind that! They're getting a print preview, they can print
it out their damn selves if they want!!!
Ok, so... Now that I'm cancelling an event, I have to supress the
message. I've been all over the group, it seems fairly clear what the
solution is, so why doesn't it work when implemented? I am
compromising enough quality by saying that they have to print the
reports for A and B manually. I can't ask them to accept a message
box that looks to them like the report has a bug or an error.
My question is... I mostly want now to suppress the message box.
=============================================================
Option Compare Database
Option Explicit
Public strCompany As String
Public lview As Integer
Private Sub Report_NoData(Cancel As Integer)
DoCmd.SetWarnings False
Cancel = True
End Sub
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Report_Open_Error
Dim rsQuery As Recordset
Dim dStartDate, dEndDate As Date
Set rsQuery = DBEngine.Workspaces(0).Databases(0).OpenRecordset( _
"SELECT * FROM tThirdPartyReport_Params")
lview = acViewPreview
If Not rsQuery.EOF Then
dStartDate = rsQuery!StartDate
dEndDate = rsQuery!EndDate
strCompany = rsQuery!Company
End If
DoCmd.SetWarnings False
Select Case UCase(Trim(strCompany))
Case "A"
Me.Visible = False
'''DoCmd.CancelEvent
Cancel = True
DoCmd.OpenReport "ThirdParty Report_A", lview
Case "B"
Me.Visible = False
'''DoCmd.CancelEvent
Cancel = True
DoCmd.OpenReport "ThirdParty Report_B", lview
Case Else
End Select
Err.Clear
Exit Sub
Report_Open_Error:
If Err.Number = 2501 Then
Err.Clear
Resume Next
End If
End Sub
want the interface changed. BUT for companies A and B, they want
changed reports. So I created reports A and B, respectively.
So I wrote the code to, if companies A or B were selected, close the
current report (which is for all other companies), and open reports A
or B.
[This is SORT of a solution, because when they ask to print a report,
they can only get a print preview of A or B, and the original report
prints out on the printer. Think of it as one report routing to
itself, A or B, depending on the selection of company.]
But nevermind that! They're getting a print preview, they can print
it out their damn selves if they want!!!
Ok, so... Now that I'm cancelling an event, I have to supress the
message. I've been all over the group, it seems fairly clear what the
solution is, so why doesn't it work when implemented? I am
compromising enough quality by saying that they have to print the
reports for A and B manually. I can't ask them to accept a message
box that looks to them like the report has a bug or an error.
My question is... I mostly want now to suppress the message box.
=============================================================
Option Compare Database
Option Explicit
Public strCompany As String
Public lview As Integer
Private Sub Report_NoData(Cancel As Integer)
DoCmd.SetWarnings False
Cancel = True
End Sub
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Report_Open_Error
Dim rsQuery As Recordset
Dim dStartDate, dEndDate As Date
Set rsQuery = DBEngine.Workspaces(0).Databases(0).OpenRecordset( _
"SELECT * FROM tThirdPartyReport_Params")
lview = acViewPreview
If Not rsQuery.EOF Then
dStartDate = rsQuery!StartDate
dEndDate = rsQuery!EndDate
strCompany = rsQuery!Company
End If
DoCmd.SetWarnings False
Select Case UCase(Trim(strCompany))
Case "A"
Me.Visible = False
'''DoCmd.CancelEvent
Cancel = True
DoCmd.OpenReport "ThirdParty Report_A", lview
Case "B"
Me.Visible = False
'''DoCmd.CancelEvent
Cancel = True
DoCmd.OpenReport "ThirdParty Report_B", lview
Case Else
End Select
Err.Clear
Exit Sub
Report_Open_Error:
If Err.Number = 2501 Then
Err.Clear
Resume Next
End If
End Sub