Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Feb 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Connecting to an Access database (2002/SP 1)

    I am using an ADODB connection string to connect to an Access database in Excel. The Access database has a workgroup directory. How can I successfully connect to the Access database. Below is the code I am using.

    With Conn
    .ConnectionString = _
    "Provider=Microsoft.Jet.OLEDB.4.0"
    .Open "Cocuments and SettingsteqcjeDesktopPermLife.mdb"
    End With

    It says I have no read rights. Any help would be greatly appreciated.

    Thanks,
    Chris

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Connecting to an Access database (2002/SP 1)

    Try

    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=c:secure.mdw"

    Of course, you must supply the correct path and file name for the workgroup file.

  3. #3
    Lounger
    Join Date
    Feb 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Connecting to an Access database (2002/SP 1)

    Hi Hans,

    I tried it, and I still get the error when I try to execute the query. My code is below:

    'Connect to Access database
    With Conn
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=O:workdirlfa.mdw"
    .Open "Cocuments and SettingsteqcjeDesktopPermLife.mdb"
    End With

    Set cmdCommand.ActiveConnection = Conn

    With cmdCommand
    'Delete everything from the FinalData table
    .CommandText = "DELETE FinalData.* FROM FinalData;"
    .Execute
    End With

    I get an error message stating, "Records cannot be read. No read permissions on FinalData".

    Can you please help me.

    Thanks,
    Chris

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Connecting to an Access database (2002/SP 1)

    I'm going to move this thread to the Access forum, because it is an Access-related question, not an Excel-related question.

  5. #5
    Lounger
    Join Date
    Feb 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Connecting to an Access database (2002/SP 1)

    Ok. Thanks.

    Chris

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Connecting to an Access database (2002/SP 1)

    Try providing the username and password too:

    With Conn
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Password=topsecret;User ID=itsonlyme;" & _
    "Data Source=Cocuments and SettingsteqcjeDesktopPermLife.mdb;" & _
    "Persist Security Info=True;Jet OLEDB:System database=O:workdirlfa.mdw"
    .Open
    End With

  7. #7
    Lounger
    Join Date
    Feb 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Connecting to an Access database (2002/SP 1)

    Hi Hans,

    It works!!!! WhooooHoooo.... <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35> You the man. Thanks for your help.

    Thanks,
    Chris

Posting Permissions

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