Check from Form module if Record exists?

  • Thread starter Davíð Þórisson
  • 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
 
W

Wayne Morgan

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.
 

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