Results 1 to 3 of 3
  1. #1
    asearle is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    24

    ODBC: Password

    Hallo Everyone,

    I have an MS-Access frontend that interacts with an Oracle database using mostly passthrough queries that are written and overwritten programmatically. These queries have the ODBC information filled out but no password information is included.

    This is extremely comfortable (both for the developer and for the user) because once one query has been called up and MS-Access has (automatically) requested the user-id and password no futher action is required and all other queries use this information.

    However, I have programmed some SQL calls (to the Oracle database) in VBA using ADO ...

    sConn = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=" & _
    "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" & _
    "(Host=mydatabase.com)(Port=15297))) " & _
    "(CONNECT_DATA = (SID = MYSID)(SERVER = DEDICATED)));" & _
    "User ID=johndoe;Password=secretpassword;"

    ... with the password being hard-coded in.

    This is of course wrong and so I will be replacing the password with a variable.

    What would be absolutely wonderful is if I could pick up the password variable that is generated/entered for the existing queries rather than have my own, second variable that the user has to enter.

    Can anyone help me with this? Am I able to capture the password that is requested/entered for standard queries?

    Many thanks for any tips on this topic.

    Regards,
    Alan Searle

  2. #2
    taxidev is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    7
    You can read the connect string on the querydef, extracting the UID and PWD values.
    Simple code example:

    Dim qDef As DAO.queryDef

    Set qDef = CurrentDb.QueryDefs("qTest")
    Debug.Print qDef.Connect

    Hope this helps.

  3. #3
    asearle is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    24

    Other way ...

    Yes, many thanks this is the property that I ended up using: In the end, I decided to prompt the user for his details when the application opens and then build the connect string myself (using the property you suggest).

    This works fine and takes all uncertainty out of the matter.

    Many thanks for the tip.

    Regards,
    Alan

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-25-2011, 08:01 AM
  2. Refresh ODBC Connection with new UserID and Password
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 06-20-2011, 10:13 AM
  3. "Automatically" populate UserID & Password for ODBC
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 06-02-2011, 11:18 AM
  4. ODBC -- call failed. | Oracle ODBC
    By drdexter33 in forum Access
    Replies: 1
    Last Post: 04-03-2010, 09:32 PM
  5. Change from old password to new password
    By richy in forum Security
    Replies: 0
    Last Post: 11-17-2005, 05:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums