Null results of a query

  • Thread starter Thread starter Guest
  • Start date Start date
Frank said:
Looking for a VB funtion to determine if a select query returns any records
or is null.


In what context?

Recordsets have a RecountProperty.

Reports have the HasData property.
 
Marshall, I'm using queries to populate forms with information such as
one employees' sales for a period. I want to check the query before opening
the form to determine if there are any records that meet the cretia. I have
a function 'Checkrec' that determines the number of records in a table (
returns -1 if no records.) It doesn't work for queries.

Thanks
Frank
 
Frank said:
Marshall, I'm using queries to populate forms with information such as
one employees' sales for a period. I want to check the query before opening
the form to determine if there are any records that meet the cretia. I have
a function 'Checkrec' that determines the number of records in a table (
returns -1 if no records.) It doesn't work for queries.


Does that mean you want to know what a **saved** query will
do given just its name?? If so, you could probably use
DCount("*","nameofquery") > 0 to check for that.

If that doen't do what you want, then you could open a
recordset on the query and check the recordset's RecordCount
property.

I have no idea how that might, or might not, fit into
whatever your existing function is doing though.
 
Back
Top