By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

help - why doesn't OpenRecordset work for a Query..??

P: n/a
If CurrentDb.OpenRecordset("table").EOF Then ... works fine

If CurrentDb.OpenRecordset("Query").EOF Then ... doesn't?????????

microsft help is outstanding too - surprise surprise

any help greatly appreciated! / Ben
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The difference is likely to be that OpenRecordset() on a local table returns
a dbOpenTable type, whereas on a query it returns a dbOpenDynaset type. The
dbOpenTable type returns the correct RecordCount instantly, whereas the
dbOpenDynaset type does not have the RecordCount until all records have been
loaded (which can be forced with a MoveLast). Chances are that this
difference accounts for what you experienced.

More importantly, using OpenRecordset on CurrentDb without explicitly
closing the recordset and setting both objects to Nothing is probably not a
good idea, as you do not get the chance to clean up.

It may be simpler and safer to use a DLookup() or DCount() on the query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"el Benno" <po***@landcorp.co.nz> wrote in message
news:cc**************************@posting.google.c om...
If CurrentDb.OpenRecordset("table").EOF Then ... works fine

If CurrentDb.OpenRecordset("Query").EOF Then ... doesn't?????????

microsft help is outstanding too - surprise surprise

any help greatly appreciated! / Ben

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.