Full Version: How Do Automate Or Set A Property For A Mysql Odbc Connection
UtterAccess Discussion Forums > Microsoft® Access > Access Modules
icemonster
so i have this code on my form to insert, update, delete etc. but thing is i set the username and password on each form. is there a way to set it globally? where it will pull the username and password assigned to a table or something? because eventually i would be using multiple usernames to connect to the mysql server for security purposes.

any help is appreciated.

CODE
  Set cnx = New ADODB.Connection
   With cnx
          .Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
                "Server=localhost;" & _
                "Port=3306;" & _
                "Option=;" & _
                "Stmt=;" & _
                "Database=mysqldatabase;" & _
                "Uid=root;" & _
                "Pwd=leaf"
BananaRepublic
May I suggest that you do not store the username/passwords?

This article demonstrates how you can set up a linked table and passthrough query without storing the uid and pwd by running a startup code and letting Access reuse the cached connection.

In your example, you're using ADO - if you want to continue using that, then I would suggest that you encapuslate your connection in a self-healing procedure. An example is provided.

I'm afraid, though, I don't understand the desire to use multiple username in a session.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.