Results 1 to 2 of 2

Thread: select * from excel

  1. #1

    Thread Starter
    Addicted Member Paradox's Avatar
    Join Date
    Sep 2004
    Location
    Nairobi
    Posts
    189

    select * from excel

    Hi am trying to select contents of a column from an excel sheet but my query keeps returning a recordcount of -1.
    how can i get round this?

    VB Code:
    1. Private Sub cmdbrowse_Click()
    2.     frmODBCLogon.Show vbModal, frmmain
    3.    
    4.     Dim strQuery As ADODB.Recordset
    5.     sADOConnect = "PROVIDER=MSDASQL;" & sDSN & sConnect
    6.     sDAOConnect = "ODBC;" & sDSN & sConnect
    7.     Set gConnection = New Connection
    8.     gConnection.Open sADOConnect
    9.     Set strQuery = New ADODB.Recordset
    10.     strQuery.Open "SELECT * FROM [Sheet1$]", gConnection, adOpenDynamic, adLockOptimistic
    11.     MsgBox strQuery.RecordCount
    Peny wise pound Foolish

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width