T
TigerTechie
Hello,
I have a command button [BUTTON B] in a form linked to call a report up and
email it based on the current record of the Form.
I also have another command button [BUTTON A] linked to the same report to
email ALL the records to the respective recipients, based on data within the
report.
The problem is this: When I run BUTTON B, and email the report to one
specific person based on the criteria, all runs well. If I attempt to run
BUTTON A after I have run BUTTON B, no information populates to the report.
I have isolated the problem to the Filter I am passing in the code on BUTTON
B. After BUTTON B runs, the Filter criteria passed from the form to the
report, remains in the report, and I am having a problem clearing it out.
I have posted my code below. I have also tried putting the following in the
Close Command of the report being called. This has not worked:
Private Sub Report_Close()
Me.Filter = ""
Me.FilterOn = False
End Sub
Any help would be appreciated. Here is the code for the [BUTTON B] Command:
========================================
Private Sub EmailSecondApprover_Click()
On Error GoTo Err_EmailSecondApprover_Click
Dim strFilter As String
'Debug.Print strSQL
If Me.[SecEmail] = "" Then
MsgBox "There is no secondary approver. Please forward the email to an" _
& " alternate AP Supervisor with the appropriate level of SOA Authority.
Thank You.", vbOKOnly, "No Secondary Approver"
End If
strFilter = "[AcctNum] = " & "'" & Me!AcctNum & "'"
DoCmd.OpenReport "1-BILLS TO REVIEW REPORT", acPreview, , strFilter,
acHidden
DoCmd.SendObject acSendReport, "1-BILLS TO REVIEW REPORT", acFormatRTF _
, SecEmail _
, _
, _
, "Utility Bill Needs Your Approval for Payment" _
, "Please review the attached file and follow any additional
instructions noted to approve this utility bill. " & _
"Send your approval email with the attached report back to
(e-mail address removed) so the bill may be processed. " & _
"Please remember that utility bills must be paid as soon as possible to
prevent late fees and disconnects. Thank you for your cooperation." _
, -1
DoCmd.Close acReport, "1-BILLS TO REVIEW REPORT", acSaveNo
Exit_EmailSecondApprover_Click:
Exit Sub
Err_EmailSecondApprover_Click:
MsgBox Err.Description
Resume Exit_EmailSecondApprover_Click
End Sub
==========================================
Thanks to whomever can help me with this issue.
I have a command button [BUTTON B] in a form linked to call a report up and
email it based on the current record of the Form.
I also have another command button [BUTTON A] linked to the same report to
email ALL the records to the respective recipients, based on data within the
report.
The problem is this: When I run BUTTON B, and email the report to one
specific person based on the criteria, all runs well. If I attempt to run
BUTTON A after I have run BUTTON B, no information populates to the report.
I have isolated the problem to the Filter I am passing in the code on BUTTON
B. After BUTTON B runs, the Filter criteria passed from the form to the
report, remains in the report, and I am having a problem clearing it out.
I have posted my code below. I have also tried putting the following in the
Close Command of the report being called. This has not worked:
Private Sub Report_Close()
Me.Filter = ""
Me.FilterOn = False
End Sub
Any help would be appreciated. Here is the code for the [BUTTON B] Command:
========================================
Private Sub EmailSecondApprover_Click()
On Error GoTo Err_EmailSecondApprover_Click
Dim strFilter As String
'Debug.Print strSQL
If Me.[SecEmail] = "" Then
MsgBox "There is no secondary approver. Please forward the email to an" _
& " alternate AP Supervisor with the appropriate level of SOA Authority.
Thank You.", vbOKOnly, "No Secondary Approver"
End If
strFilter = "[AcctNum] = " & "'" & Me!AcctNum & "'"
DoCmd.OpenReport "1-BILLS TO REVIEW REPORT", acPreview, , strFilter,
acHidden
DoCmd.SendObject acSendReport, "1-BILLS TO REVIEW REPORT", acFormatRTF _
, SecEmail _
, _
, _
, "Utility Bill Needs Your Approval for Payment" _
, "Please review the attached file and follow any additional
instructions noted to approve this utility bill. " & _
"Send your approval email with the attached report back to
(e-mail address removed) so the bill may be processed. " & _
"Please remember that utility bills must be paid as soon as possible to
prevent late fees and disconnects. Thank you for your cooperation." _
, -1
DoCmd.Close acReport, "1-BILLS TO REVIEW REPORT", acSaveNo
Exit_EmailSecondApprover_Click:
Exit Sub
Err_EmailSecondApprover_Click:
MsgBox Err.Description
Resume Exit_EmailSecondApprover_Click
End Sub
==========================================
Thanks to whomever can help me with this issue.