473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
1 8192
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: alessia | last post by:
hi, I have a query that visualizes me, according to some criterions from me inserted, name , Surname , Address , phone ok.. Now, through a button, positioned in a Form, I have to only export...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
5
by: DBQueen | last post by:
I have a database where the user will have the opportunity to set up a number of Tests. I want the user to be able to enter the equation if a field for a particular test is to be a calculated...
1
by: corsibu | last post by:
hello , i just wanted to ask if there's anyone who could help me do the following thing : i have an empty temporary table, this table will have a row filled with data grabbed by a querry at this...
2
by: oh4real | last post by:
Howdy all. I have pretty much NO VB/Access coding experience, but am forced to come up with a generic script/process for users with varying database designs and varying levels of expertise to use...
9
by: sara | last post by:
Hi - I have code (below) that ran as recently as Monday. We decided to change the location for the output reports, and now the code errors (13 Type Mismatch) on the query. The query runs fine...
11
by: troy_lee | last post by:
I have two fields on a form. These two fields' values are based on an expression and represent a date range. I need to create a SQL statement that will use the returned values of these two fields...
3
by: Lester | last post by:
I'm driving myself crazy with a problem in trying to translate a query written for Access to that for SQL server. I would think that I would use a trigger, but am not sure how to set it up. We...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.