Re: ODBC Connection returns no Data
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Tue, 25 Sep 2007 14:58:38 -0400
Frank wrote:
Hello,
I'm connecting to an odbc datasource (here: AR System ODBC Driver)
What is "AR System"?
with ADO
2.8 in a Microsoft Access XP Database with VBA. I define the
Connection String, the command string and a recordset, open the
connection and open the recordset. All these Actions complete without
error. But the recordset contains no data. The loop "While Not
rs.EOF" is not being entered. I can enumerate the Fieldnames of the
recordset, the state of the recordset and the connection are "Open".
But the command "rs.MoveNext" fails with the error "Driver not
capable".
?
That is not the message one would receive if the recordset is empty. You
should receive a message that says something about BOF and EOF being
True
You had better show us your code.
The same command string (SELECT...), pasted in an Excel MS
Query, returns data. I think the ODBC driver version changed but has
anyone here an idea? Why can a recordset be opened successfully, but
returns no data?
Let's get rid of this first misconception: data not being returned will
not prevent a recordset from opening. It is a common practice to open a
recordset using a query that retrieves no records when all one wants to
do is add records to the data source. You need to check EOF immediately
after opening the recordset to see if it contains records, because a
recordset's cursor will always point at the first record if records
exist. If you've navigated through the recordset or deleted records from
it, then you need to check both BOF and EOF to determine if it still
contains data.
I don't understand this bit about "the ODBC driver version changed " -
isn't the Excel MS Query using the same ODBC driver that your VBA code
is using? Why is the ODBC version relevant?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Follow-Ups:
- Re: ODBC Connection returns no Data
- From: news.microsoft.com
- Re: ODBC Connection returns no Data
- References:
- ODBC Connection returns no Data
- From: Frank
- ODBC Connection returns no Data
- Prev by Date: ODBC Connection returns no Data
- Next by Date: Re: ODBC Connection returns no Data
- Previous by thread: ODBC Connection returns no Data
- Next by thread: Re: ODBC Connection returns no Data
- Index(es):
Relevant Pages
|
|