#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2004
    Posts
    3
    Rep Power
    0

    Red face Opening .DBF file using ADODB connection..


    Hello,

    I am trying to open a Dbase File using VB6 ADODB connection. I am getting this error message: "Path is not a valid path. Make sure that the path is spelled correctly and that you are connected to the server on which the file resides."

    I know and know that the 2 conditions are met. The code is as follows:
    ___________

    Private Sub Form_Load()
    Dim Conn
    Set Conn = CreateObject("ADODB.Connection")
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\CUSTOMER.DBF;Extended Properties=DBASE IV"
    End Sub

    ___________

    I know you can open dbf with ADO. and as far i can see in the documentation, the 'extented properties' paremeter is important, i tried the above and also tried one other format:
    ... Extended Properties=""DBASE IV;"";"
    and that gave the same error message.

    I can open the dbf file easily from a DAO control, by specifying the table name in 'recordsource' and 'dbase IV' in Connect property; but I want to do it in ADO so i can have more flexibility in controlling the record source at run time.

    Thank you for any input,

    Regards and God bless
    vchell
  2. #2
  3. No Profile Picture
    Grumpier Old Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2003
    Posts
    10,143
    Rep Power
    190
    Did you read your error message? Is the dbf file actually in the root directory of the C drive at the path you specified?
    ======
    Doug G
    ======
    I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2004
    Posts
    3
    Rep Power
    0

    dbf file exists in the right place..


    Yes, Doug, the file exists for sure in the same place mentioned in the code, and I am using XP home.

    THanks
    Vchell
  6. #4
  7. No Profile Picture
    Grumpier Old Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2003
    Posts
    10,143
    Rep Power
    190
    Did you post the exact error message?

    Post a bit more code.

    Have you stepped through your code with the debugger? You should be able to pinpoint the problem in no time.
  8. #5
  9. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Oct 2004
    Location
    Oakland, CA, USA
    Posts
    131
    Rep Power
    14
    Hello vchell,

    You just need to specify the PATH only for your Data Source. Try below, it will work.

    Code:
    Private Sub Form_Load()
    Dim Conn
    Set Conn = CreateObject("ADODB.Connection")
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=DBASE IV"				 
    End Sub
  10. #6
  11. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Did u try with a double slash


    Did u try with a double slash as follows

    Private Sub Form_Load()
    Dim Conn
    Set Conn = CreateObject("ADODB.Connection")
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\;Extended Properties=DBASE IV"
    End Sub

Similar Threads

  1. Creating Connection to different file extention
    By eddy99 in forum Microsoft Access Help
    Replies: 8
    Last Post: August 3rd, 2004, 06:53 AM
  2. Problem with : Database Connection or Parameters ?
    By Elankathir in forum ASP Development
    Replies: 1
    Last Post: July 1st, 2004, 12:08 AM
  3. Opening a file in a new window
    By shivim in forum ASP Development
    Replies: 2
    Last Post: November 19th, 2003, 11:22 AM
  4. Opening an excel file
    By Neider in forum .NET Development
    Replies: 0
    Last Post: June 23rd, 2003, 04:21 PM
  5. Web serverístatistical analysis
    By cso in forum ASP Development
    Replies: 0
    Last Post: April 19th, 2003, 11:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo