Pass Through Query with Custom Login Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    Pass Through Query with Custom Login Form

    I've created a pass through query, but I don't want the credentials saved in the connection string. So when I run it, it asks for a password. Is there a way to pass it the credentials from a custom login screen instead of the ugly Microsoft screen that comes up? I guess I could change the connection string at run-time using code, but that seems clunky. I'm hoping for a query.execute, UID="", PWD="" type option, but I can't find anything in a google search.
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3653

    #2
    Seth,

    From what I understand, you "should" be able to have a user login/password form and then generate the Connection String from there. This prevents you from saving passwords and all that security stuff that MS Access isn't good at. it should look something like this:

    Code:
    qdf.Connent = "ODBC;DRIVER={Microsoft ODBC for Oracle};UID=abcdef;PWD=12345678;SERVER=serverabc123;"
    This is a bit outside my wheelhouse, but this may get you started in creating that string.....

    Comment

    • Seth Schrock
      Recognized Expert Specialist
      • Dec 2010
      • 2965

      #3
      Well, I was hoping for a different way, but I'll probably just have to go that route.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        I assume Windows (AD or AAD) security is unavailable. I always prefer to use that where it's available.

        Comment

        • Seth Schrock
          Recognized Expert Specialist
          • Dec 2010
          • 2965

          #5
          You are correct in your assumption. I too prefer AD, but in this case I'm connecting to a program that has its own user database.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            Hi Seth.
            I believe that if you make a Connection to the server first, then run the query when that Connection has been established, it should use the existing credentials without re-prompting when the query is run. Close the Connection object when done of course ;-)

            Comment

            • Seth Schrock
              Recognized Expert Specialist
              • Dec 2010
              • 2965

              #7
              Hmmm. That just might work. I have noticed that once I run the query, it doesn't ask me for a password for any of my queries for a long time. And it would be easy to build a "login" form that simply opens a connection using the provided credentials, allowing the queries to then run without the password prompt. I wonder if manually closing the connection would make the queries prompt for a password again. Definitely something to work on.

              Thanks NeoPa!

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32633

                #8
                Originally posted by Seth Schrok
                Seth Schrok:
                I wonder if manually closing the connection would make the queries prompt for a password again.
                Yes. Always assuming nothing else is keeping the connection open - such as a query or linked table that's using the Connection.

                Comment

                Working...