Check from Form module if Record exists?

  • Thread starter Thread starter Davíð Þórisson
  • Start date Start date
D

Davíð Þórisson

Hi!
using some VB code for a button's onclick event I want to check if a query
(based on form's values) is empty or not...
which is the best way to do it?


thx
David
 
How are you calling the query and what are you going to do with it. If all
you want is a quick record count, try the DCount function. If you've created
a recordset, check to see if you're at

If rst.BOF And rst.EOF Then
'there are no records
'Msgbox or whatever you want here
End If

If both are true, then there are no records in the recordset. BOF is
Beginning Of File and EOF is End Of File.
 
Back
Top