Test If Query Output is Null

J

JR_06062005

I've setup VB script to export query results to a file. If the query output
is null or has no records, I would like to provide the user with a message
rather than export an empty file.

Also, I would like to detect if there are empty values for a particular
field in the query and alert the user of this. Is there a way to do this?

Any help is appreciated.
 
A

Alex Dybenko

Hi,
you can use for example DCount() function, to check if your query return any
record:

if DCount("*","MyQyery")=0 then
MsgBox "No Records!"
else
'export
end if
 
J

JR_06062005

It works. Thanks

Alex Dybenko said:
Hi,
you can use for example DCount() function, to check if your query return any
record:

if DCount("*","MyQyery")=0 then
MsgBox "No Records!"
else
'export
end if
 

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