Error for record not found to report to user

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

Background:

If you have a search which is part of a form. It looks information up in a
snap shot query which is a summary of another tabel (SA table) based on a
key found in another teh Roster table. There may be more discrete enteries
in the roster tabel than in the SA table. If records do not exist in the in
teh SA sanp shot i would like to detect this and reprt to the user that they
need to create a new record for the ID.

Question:

How do i detect that no records were found so I can print a message?

Thanks in advance,

Dick
 
Hi Dick,

Probably the thing to do is to use DCount() on the query first to see if
it will return any records, e.g. something like

If DCount("*", "MyQuery) = 0 Then
MsgBox "You need to create a new record", _
vbInformation + vbOKOnly
Else
...
End If
 
Thankyou John,

I decided to try to assess the field and trap the error in my code. By
doing so access does the chaeck for me and tells me that there is no such
field.

I think that's 2724.

Happy New Year John.

Dick
 
Back
Top