Test to see a table has record

S

Song Su

I use qryCreateCompEn to create a table with field EN which is integer. I
want to see if the table has record or not. My IF statement generates error
message "Type mismatch". Where did I do wrong?

Thanks.

DoCmd.SetWarnings False
DoCmd.OpenQuery "qryCreateCompEn"

If "SELECT Sum(CompEn.EN) AS ENOfSum FROM CompEn =0" Then
MsgBox "No record need to print.", vbInformation, conAppName
Else
DoCmd.OpenQuery "qryCreateCompEnHour"
DoCmd.OpenForm "frmMarkPrintComplete"
End If
DoCmd.SetWarnings True
 
Top