Question : vba code to show a message when no records exist when a form is opened

I would like to programatically show a message that no records exist when a form is opened and no records exist OR if records exist and the user tries to click the record navigation arrows to go beyond the "last record".  The field that I am using to identify records is "CRFNum".  Could someone help me with this?  Thanks.  Right now the code below works great that sets three different values when records exist.  When records do not exist, I would like the no records exist message to pop up......
Code Snippet:
1:
2:
3:
4:
5:
Private Sub Form_Current()
Me.z_CRF_RcvdDate.Form.RcvdDate.Value = Me.Return_Date
Me.z_CRF_RcvdDate.Form.CurrentStatus.Value = 2
Me.z_CRF_RcvdDate.Form.DateClosed.Value = ""
End Sub

Answer : vba code to show a message when no records exist when a form is opened

misread the question, if you only want to see message when count = 0, the code would be as follows:

Private Sub Form_Open()
           If Me.RecordsetClone.RecordCount  = 0 Then                'Forms!YourForm.RecordsetClone
                   MsgBox "There are no records"
           End If
End Sub
Random Solutions  
 
programming4us programming4us