Thank you for the reply. My query has data but no data in respect of a particular "EmpID". I am trying to change your code to suit the situation. Can you help me?
If DCount("*", "YourQueryName", "EmpID =" & Me.EmpID) > 0 Then
DoCmd.OpenForm "FormName", , , "EmpID =" & Me.EmpID
Else
MsgBox "No Matching Record Found!"
End If
If EmpID is Text
Code:
If DCount("*", "YourQueryName", "EmpID ='" & Me.EmpID & "'") > 0 Then
DoCmd.OpenForm "FormName", , , "EmpID ='" & Me.EmpID & "'"
Else
MsgBox "No Matching Record Found!"
End If