Message Box if there are No Records in a Form
Hi
I am trying to get a Message Box if there are No Records in a Form, here is the code.
thank you in advance :o
Pretty
VB Code:
Private Sub Command40_Click()
On Error GoTo Err_Command40_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim intHolder As Integer
intHolder = DCount("UnitAreaName", "qryMainDue")
If intHolder > 0 Then
stDocName = "frmDue"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "There are no records, therefore the request has been cancelled"
End If
Exit_Command40_Click:
Exit Sub
Err_Command40_Click:
MsgBox Err.Description
Resume Exit_Command40_Click
End Sub
Re: Message Box if there are No Records in a Form
if you want to display the message box by checking the number of records then you wnat to check the recordset by using "recordcount" property.