Results 1 to 2 of 2

Thread: [RESOLVED] Problem opening some EXCEL files with bound controls

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    403

    Resolved [RESOLVED] Problem opening some EXCEL files with bound controls

    I have two problems, of related but different nature. This question refers to only the first :

    (VB6 running under XP)

    On my form I have placed an ADODC1 and a DATAGRID1. The DATAGRID has its DATASOURCE set as ADODC1.

    I am using this simple code to load a .xls data file to the ADODC : The string PATH has been set to the path of the desired .xls file - eg. "C:\Test.xls"

    CHARA = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PATH & ";Extended Properties=""Excel
    8.0;HDR=No;IMEX=1"";"

    Adodc1.ConnectionString = CHARA

    Adodc1.RecordSource = "[SHEET1$]"

    Adodc1.Refresh

    Adodc1.Caption = PATH

    On certain .xls files this works fine, and all the rows/columns appear in the datagrid. However when I attempt to load other .xls data files I get an error message :

    "Invalid SQL Statement. Expected Delete, Insert, Procedure, Select or Update."

    I suspect the problem lies with the connection string. Can anyone please assist?

    camoore
    Last edited by camoore; Jun 4th, 2013 at 07:41 AM. Reason: Typo

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