What do you plan on doing with that information when you get it?
It is not very efficient to count the number of records (DCOUNT) or even use
the DLOOKUP to get a single record from a query before doing something with
the query. If there are zero records, then you can avoid doing something,
but if there are records, then you end up having to run the query again to do
whatever it was you were going to do with the results of the query (report,
form, ...)
With queries that take more than a couple of seconds to run, I find that it
makes more sense just to open the report or form that you are using the query
for, and then use one of the events associated with that object to determine
whether there are any records in the queries result set or not, and take the
appropriate action.
If it is the RecordSource for a report, you can use the NoData event to
display a message and cancel opening the report.
If it is the RecordSource for a Form, then you can use code similar to the
following in the Forms Load event:
Public Sub Form_Load
Dim strMsg as string
strMsg = "No records, you are on a new record"
if me.recordsetclone.recordcount = 0 then msgbox strMsg
end sub
--
HTH
Dale
email address is invalid
Please reply to newsgroup only.