Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    8

    Unanswered: Log in to SQL using VBA in Access.

    Hello, hope you guys can help me out on this one. I have an MS Access App. that uses SQL as the backend through ODBC. I would like to force my Access App. to use a specific user account every time it queries the SQL Database.

    Can someone give me a code example of a VBA string I can use to completely bypass whatever user is logged into the workstation, and have my app use a user account I specify within the VBA code.

    Your help is much appreciated.
    Jovix

  2. #2
    Join Date
    Jan 2006
    Location
    Los Angeles, CA
    Posts
    63
    Try this:
    "Driver={SQLServer};Server=Your_Server_Name;Databa se=Your_Database_Name;Uid=Your_Username;Pwd=Your_P assword;"

    And check this website (might be helpful). http://www.sqlstrings.com/

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd be inclined to look at sp_setapprole instead. This allows every user to retain their own identity (so you can later blame the innocent), while allowing your application to use a single signon to the database that isn't available to the users (to allow you to protect the guilty).

    -PatP

  4. #4
    Join Date
    Aug 2004
    Posts
    8
    ^^ Thanks guys...to get my app running asap, I'll use the Driver string. But I'll definetely look into sp_setapprole.

Posting Permissions

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