MSAccess vba dsnless connection to sql server; password issues

Connie S 21 Reputation points
2021-05-17T13:27:44.68+00:00

I am trying to create a DNSless connection to an SQL server we host that is managed by someone else. I want to be able to create an accde front end so others on the network can run reports I’ve designed in modules I’ve created in vba, from data on said sql server. Here’s what I have so far:

I created an ODBC 32 bit file DSN connection to the sql server and for the authentication, chose ‘With SQL Server authentication using a login ID and password entered by the user’.

I then created a linked table in MSAccess to this table. As it is not a trusted connection, it asked me to log in. I was able to open the table and see the data.

If I close MSAccess, then reopened the database and tried to look at the table or run a vba query, I’m asked for a password again. It defaults to my windows user id.

So… I found how to edit the file dsn and add the password (already had the user name). I opened the file with notepad and added the info. When I open the file dsn via the odbc data source administrator, looks good (a password is there)!

I build a new linked table in msaccess and used the new connection with the password. No prompt when building the link. And I can open the table without a password!

I exit MSAccess and reload the database. Now I am prompted for the user id & password, defaulting to my windows id. Grrr!

How can I automate logging in to the sql server so that the users (or any scheduled reports that run) do not have to enter that user id?

Microsoft 365 and Office Access Development
0 comments No comments
{count} votes

Accepted answer
  1. DBG 2,381 Reputation points Volunteer Moderator
    2021-05-24T14:33:47.987+00:00

    If you use the ODBC Wizard on the new machine, are you able to get a successful connection?

    0 comments No comments

8 additional answers

Sort by: Most helpful
  1. DBG 2,381 Reputation points Volunteer Moderator
    2021-05-24T13:29:46.43+00:00

    Hi. That is correct. When you use a File DSN to connect to a server, Access converts it into a DSN-less connection. What does the error message for 3151 say?

    0 comments No comments

  2. Connie S 21 Reputation points
    2021-05-24T13:34:03.02+00:00

    ODBC connection failed

    0 comments No comments

  3. Connie S 21 Reputation points
    2021-05-25T11:23:14.977+00:00

    I am not. Tried copying my file dsn to this machine and it said it was invalid. Tried setting up a new one and could not find the server.

    Thanks for your help! I will reach out to the network administrator and see what's up.

    0 comments No comments

  4. DBG 2,381 Reputation points Volunteer Moderator
    2021-05-25T16:34:37.847+00:00

    Okay, good luck. Sounds like it may be a network issue.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.