I have a mysterious bug that keeps popping up. I'm afraid my db has been corrupted, but I'm not sure or how to fix it if it is.
I've ripped it apart a dozen times and I'm just getting more confused. There are several eyebrow raising things going on here.
I am checking the record count of a UNION query to make sure each query is returning a record. If not I do not want to run the report and also want to offer the user the option of viewing the underlying data.
Here's the simplest way I've tried to accomplish this using the DCount function. I keep getting runtime error 13: Type Mismatch using the message box. I've used message boxes for this thousands of times. I can't figure out why this is happening.
Code:
Private Sub cmdEnhancedCaseManagement_Click()
On Error GoTo errHandler
Dim intResponse As Integer
Dim intCount as Integer
intCount = DCount("*", "qryECM_Report_1")
If intCount < 3 Then
intResponse = MsgBox("No records qualify for either the F2F or InHome numerators." & vbNewLine And vbNewLine & _
"Do you wish to review your data?", vbYesNo)
If intResponse = 6 Then DoCmd.RunMacro "macECM_ExportDenominator"
End If
GoTo ExitSub
DoCmd.OpenReport "rptEnhancedCaseManagement", acViewReport
ExitSub:
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
GoTo ExitSub
End Sub