[AccessD] Win 2K; open an existing query in code

John Colby jcolby at colbyconsulting.com
Thu Oct 30 19:59:22 CST 2003


Liz,

Yep, can be done.  One way (DAO)

dim db as dao.database
dim rst as dao.recordset
dim blnNoRecords as boolean
dim lngRecCnt as long

	set db = currentdb
	set rst = db.open("MyQryName")
	blnNoRecords = rst.eof

OR...
	rst.movelast
	lngRecCnt = rst.recordcount

Someone else can pipe up with the ADO equivalent.

Alternatively you could build a summation query that returns just a count of
a field in the first query.

Lots of ways to skin this cat. (blech, what a saying!)

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Elizabeth
Carter
Sent: Thursday, October 30, 2003 4:42 PM
To: Access List
Subject: [AccessD] Win 2K; open an existing query in code


Hi All,

I have tried searching the archives and have not found the answer that I
seek... probably means answer is no :)

I would like to know if it's possible to open an existing query and store
it's output into a recordset. I don't want a form to open that the user
sees, I just want to know in code if the query will return any rows or not.

Any help would be greatly appreciated.

Liz
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list