No Records

  • Thread starter Kenneth H. Young
  • 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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top