How to detect a empty query

  • Thread starter Thread starter joten
  • Start date Start date
J

joten

I have a form where I put data according orders by fax are arriving
Sometimes the faxes have arrived duplicated, so we duplicated th
orders, reason why I am trying the database detects if in previous 1
days there is an order of equal amount for this client exists. I hav
got the corresponding query, but the problem is that this query shows
whenever I register an order: a query without data if there is n
duplicity and with data if there is. I don´t know how to get a quer
that only shows when the query has any data.

Thank you in advance
 
Hi,


You can count the number of records, explicitly, or make a query:

SELECT COUNT(*) FROM myQuery


such as


If 0 = db.OpenRecordset("SELECT COUNT(*) FROM myQuery").FIelds(0).Value
Then
...


or

If 0 = DCount("*", "myQuery") Then
...


in the VBA code that would eventually use the query, if there is records in
it.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top