Re: Missing first row in recordset from excel using .getrows
- From: "Andrew" <me@xxxxxxxx>
- Date: Wed, 24 Jan 2007 15:50:27 +0900
:) - thanks for the syntax tip. As you can see I'm new at ADO
"Lance Wynn" <LanceWynn@xxxxxxxxxxxxxxxx> wrote in message
news:uLctZx3PHHA.3316@xxxxxxxxxxxxxxxxxxxxxxx
Sorry,
you have to make sure that you use double quotes around the Extended
properties field.
.ConnectionString = "Data Source=" & sFile & "; Extended
Properties=""Excel
8.0;HDR=No"""
"Andrew" <me@xxxxxxxx> wrote in message
news:45b6ede6$0$7950$5a62ac22@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Lance...
I spoke too quickly.
When I add this in, it says "Could not find installable ISAM". I am using
VB6 not .NET if that makes a difference.
Cheers
Andrew
"Andrew" <me@xxxxxxxx> wrote in message
news:45b6e34f$0$7996$5a62ac22@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'm using the following code to get a recordset of an excel file. I use
the getrows call to fill the variant array p. The problem is the first
row
is always missing. Is there a flag or something I can set? Also, when I
set a watch, I see properties called NAME, VALUE and ORGINALVALUE. What
do
they actually means, as. I notice that in the first record, the value for
row1 is actually in the NAME property, but the value of row 2 is in the
VALUE property.
Thanks
Andrew
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=" & sFile & "; Extended
Properties=Excel
8.0;"
.Open
End With
'Extenatiate the recordset
Dim RDB As ADODB.Record
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.LockType = adLockBatchOptimistic
Dim p As Variant
'Set query string
cSQL = "SELECT * FROM " & "[" & Trim(cWork***) & "$]"
'Open the recordset with the above connection
rs.Open cSQL, cn
p = rs.GetRows
rs.close
.
- References:
- Missing first row in recordset from excel using .getrows
- From: Andrew
- Re: Missing first row in recordset from excel using .getrows
- From: Andrew
- Re: Missing first row in recordset from excel using .getrows
- From: Lance Wynn
- Missing first row in recordset from excel using .getrows
- Prev by Date: Re: Missing first row in recordset from excel using .getrows
- Next by Date: Re: MDAC 2.8 and Windows XP SP1
- Previous by thread: Re: Missing first row in recordset from excel using .getrows
- Next by thread: Is HDR=?? supported in connection string in VB6?
- Index(es):