H
Hanksor
Ok, I hope I can make this clear. when I open the form using the
DoCmd.OpenReport command and the report has data,everything is fine. If the
report is empty and the line "Cancel = True" is in the NoData area, it
crashes. Something about DoCmd.OpenReport and pressing Cancel. I'm trying
to use a combobox to select the information to open the report and if the
report is empty, alert me and exit. Anyone have any ideas? I hope I've
made this understandable. Any help will be appreciated.
PS. works if CANCEL = True isn't present but runs the messagebox twice and
opens the blank report if no data.
-----Click command from combobox form-----
Private Sub cmdFindPMOK_Click()
Dim stDocName As String
stDocName = "rptChargeVerificationPM"
DoCmd.OpenReport stDocName, acViewPreview
End Sub
---Events inside the report------
Option Compare Database
Option Explicit
Dim ND As Boolean
Private Sub Report_Close()
Dim strSql As String
Dim strID As String
If Not ND Then
MsgBox ("Updated!!")
strID = Me!CardHolderIDtxt
strSql = "UPDATE tblChargeVerification SET Submitted = True WHERE Submitted
= False AND CardHolderID = '" & strID & "';"
DBEngine(0)(0).Execute strSql, dbFailOnError
End If
End Sub
Private Sub Report_NoData(Cancel As Integer)
ND = True
MsgBox ("There are no items to Print")
End Sub
DoCmd.OpenReport command and the report has data,everything is fine. If the
report is empty and the line "Cancel = True" is in the NoData area, it
crashes. Something about DoCmd.OpenReport and pressing Cancel. I'm trying
to use a combobox to select the information to open the report and if the
report is empty, alert me and exit. Anyone have any ideas? I hope I've
made this understandable. Any help will be appreciated.
PS. works if CANCEL = True isn't present but runs the messagebox twice and
opens the blank report if no data.
-----Click command from combobox form-----
Private Sub cmdFindPMOK_Click()
Dim stDocName As String
stDocName = "rptChargeVerificationPM"
DoCmd.OpenReport stDocName, acViewPreview
End Sub
---Events inside the report------
Option Compare Database
Option Explicit
Dim ND As Boolean
Private Sub Report_Close()
Dim strSql As String
Dim strID As String
If Not ND Then
MsgBox ("Updated!!")
strID = Me!CardHolderIDtxt
strSql = "UPDATE tblChargeVerification SET Submitted = True WHERE Submitted
= False AND CardHolderID = '" & strID & "';"
DBEngine(0)(0).Execute strSql, dbFailOnError
End If
End Sub
Private Sub Report_NoData(Cancel As Integer)
ND = True
MsgBox ("There are no items to Print")
End Sub