How to detect a empty query

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
 
M

Michel Walsh

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
 

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