Re: Missing first row in recordset from excel using .getrows

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



:) - 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(cWorkSheet) & "$]"
'Open the recordset with the above connection
rs.Open cSQL, cn
p = rs.GetRows
rs.close







.



Relevant Pages

  • Re: Missing first row in recordset from excel using .getrows
    ... I'm using the following code to get a recordset of an excel file. ... the getrows call to fill the variant array p. ... The problem is the first row ... Dim RDB As ADODB.Record ...
    (microsoft.public.vb.database.ado)
  • Re: Missing first row in recordset from excel using .getrows
    ... I'm using the following code to get a recordset of an excel file. ... the getrows call to fill the variant array p. ... The problem is the first row ... Dim RDB As ADODB.Record ...
    (microsoft.public.vb.database.ado)
  • Missing first row in recordset from excel using .getrows
    ... I'm using the following code to get a recordset of an excel file. ... getrows call to fill the variant array p. ... The problem is the first row is ... Dim RDB As ADODB.Record ...
    (microsoft.public.vb.database.ado)
  • Re: GUI for access 2002
    ... just referencing the first record in it. ... Is it a one-record recordset, ... the form named "change members" is not opened, ... I spent some time tiring ...
    (microsoft.public.access.gettingstarted)
  • Re: Missing first row in recordset from excel using .getrows
    ... It is using the first row for field names. ... I'm using the following code to get a recordset of an excel file. ... getrows call to fill the variant array p. ... Dim RDB As ADODB.Record ...
    (microsoft.public.vb.database.ado)