A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Test for query returning no records



 
 
Thread Tools Display Modes
  #1  
Old October 4th, 2005, 05:48 PM
The Grape Hunter
external usenet poster
 
Posts: n/a
Default Test for query returning no records

Access 2003. Trying to implement some VBA code (logic) to test if a query
returns zero records. It is not even clear for me how or what I test for.
Obviously if the record count in the query results is zero then my condition
has been found, but I am at a loss as to the "best" If statement to build to
test for this. Is an empty (no records) query result considered a null set,
and will the IsNull function test properly ? Thanks in advance for the great
help always found here.

  #2  
Old October 4th, 2005, 10:20 PM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

You can simply use DCount() function to check whether the Query returns any
row.

Check Access VB Help on the DCount() function.

--
HTH
Van T. Dinh
MVP (Access)


"The Grape Hunter" wrote in
message ...
Access 2003. Trying to implement some VBA code (logic) to test if a query
returns zero records. It is not even clear for me how or what I test for.
Obviously if the record count in the query results is zero then my
condition
has been found, but I am at a loss as to the "best" If statement to build
to
test for this. Is an empty (no records) query result considered a null
set,
and will the IsNull function test properly ? Thanks in advance for the
great
help always found here.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Union query with left join Abdula Zakaria via AccessMonster.com Running & Setting Up Queries 4 April 23rd, 2005 11:58 AM
Information from Table to Report Dahlman General Discussion 6 April 11th, 2005 09:57 PM
Edit properties of linked subforms problem (repost) Allen Browne Using Forms 3 November 12th, 2004 08:16 PM
Union Query returning Duplicate Records Mike_Walrus Running & Setting Up Queries 1 August 19th, 2004 09:40 PM
New records can't be seen rleblanc Using Forms 6 August 14th, 2004 02:43 PM


All times are GMT +1. The time now is 08:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.