No Records

  • Thread starter Thread starter Kenneth H. Young
  • Start date Start date
K

Kenneth H. Young

I have a form with a query for a data source that returns mismatched data.

SELECT Arpwatch.IP, Arpwatch.Name, Arpwatch.[Mac Address], Arpwatch.[Last
Seen]
FROM Arpwatch LEFT JOIN [DHCP List] ON Arpwatch.IP = [DHCP List].[Client IP
Address]
WHERE ((([DHCP List].[Client IP Address]) Is Null));

When no records are returned the form opens and displays a blank page. I
have tried applying an 'On Load' event that if 'IP' is null to display a
msgbox that there is no data to display and then close the form. I have also
tried If Not IsNull then ... Else msgbox and then close. Nether of these
work. How can I handle this if no records are returned by the query?

Thank you for any assistance

Ken
 
Kenneth said:
I have a form with a query for a data source that returns mismatched data.

SELECT Arpwatch.IP, Arpwatch.Name, Arpwatch.[Mac Address], Arpwatch.[Last
Seen]
FROM Arpwatch LEFT JOIN [DHCP List] ON Arpwatch.IP = [DHCP List].[Client IP
Address]
WHERE ((([DHCP List].[Client IP Address]) Is Null));

When no records are returned the form opens and displays a blank page. I
have tried applying an 'On Load' event that if 'IP' is null to display a
msgbox that there is no data to display and then close the form. I have also
tried If Not IsNull then ... Else msgbox and then close. Nether of these
work. How can I handle this if no records are returned by the query?


Check the form for no records like this:

If Me.RecordsetClone.RecordCount > 0 Then
' Do whatever when there is data
Else
MsgBox "No unmatched records"
DoCmd.Close acForm, Me.Name, acSaveNo
End If
 
Back
Top