Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ConnectionString (A2K3)

    Edited by HansV to replace Word doc with a trimmed version of the picture it contained - fewer clicks for the reader

    I need help with creating a ConnectionString from Access to a SQL Server. I have the following:
    <hr> connectionString = "ODBC;DRIVER={SQL Server}" _
    + ";SERVER=" & "NameOfServer" _
    + ";DATABASE=" + SrcDatabaseName _
    + ";UID=" + "dm_user" _
    + ";PWD=" + "dm" + ";"<hr>

    SrcDatabaseName=the SQL Server DB Name. For the server, I don't need a UID or PWD. The table is linked but I can't access the data and I get the attached message. What am I doing wrong? Please HELP!
    Attached Images Attached Images
    • File Type: png x.png (11.2 KB, 0 views)
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

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

    Re: ConnectionString (A2K3)

    What happens if you remove the part after SrcDatabaseName?

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ConnectionString (A2K3)

    Hans,

    I changed the code as suggested to:

    <hr> connectionString = "ODBC;DRIVER={SQL Server}" _
    + ";SERVER=" & "KMHPSQLKY20" _
    + ";DATABASE=" + SrcDatabaseName + ";"
    <hr>

    but get the same error. Oddly, I can put the table in a query, see all the fields but when I go to run the query, I get the same message.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

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

    Re: ConnectionString (A2K3)

    If you have already linked the table, why do you need a connection string?

  5. #5
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ConnectionString (A2K3)

    I resolved the problem. See code.

    <hr>Long piece of code moved to attachment by HansV<hr>

    I moved the table to another db on the server and everything went fine. Thanks Hans for your assistance, as always, it's appreciated.
    Attached Files Attached Files
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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