N
nik
Hi,
This seems like it should be obvious, but various attempts just don't
seem to work.
I'm using Access '07 as a FE to MySQL BE, via ODBC 5.1, with linked
tables. Everything works well, except whenever Access first connects
to the BE the MySQL Connector/ODBC Data Source Configuration pops up
asking for the user and password. I want the user to enter this
information into a custom login form and then set it with the code
instead of having to use the pop-up.
I've tried adding the user name and password to the tabledefs.connect
and then using RefreshLink to establish the connection for the first
time:
sConnect = "ODBC;Driver={MySQL ODBC 5.1 Driver};" & _
"SERVER=" & mdlConst.sMYSQLSERVERNAME & ";" & _
"PORT=3306;" & _
"DATABASE=" & mdlConst.sMYSQLDATABASENAME & ";" & _
"USER=" & mdlConst.sMySQLUSERNAME & ";" & _
"PASSWORD=" & sPassword ' & ";"
For i = 0 To CurrentDb.TableDefs.Count - 1
If (CurrentDb.TableDefs(i).Connect <> "") Then
CurrentDb.TableDefs(i).Connect = sConnect
CurrentDb.TableDefs(i).RefreshLink
End If
Next
But the MySQL ODBC Configuration still pops up asking for the username
and password.
Interestingly, the CurrentDb.TableDefs(i).Connect does not have the
user name or password in the string after the CurrentDb.TableDefs
(i).RefreshLink command.
I've also tried UID and PWD instead of USER and PASSWORD, without
success.
Am I missing something? I'm not trying to change the table link, I
just want to set the username and password through the code instead of
having someone have to use the configuration pop-up.
Thanks,
Nik
This seems like it should be obvious, but various attempts just don't
seem to work.
I'm using Access '07 as a FE to MySQL BE, via ODBC 5.1, with linked
tables. Everything works well, except whenever Access first connects
to the BE the MySQL Connector/ODBC Data Source Configuration pops up
asking for the user and password. I want the user to enter this
information into a custom login form and then set it with the code
instead of having to use the pop-up.
I've tried adding the user name and password to the tabledefs.connect
and then using RefreshLink to establish the connection for the first
time:
sConnect = "ODBC;Driver={MySQL ODBC 5.1 Driver};" & _
"SERVER=" & mdlConst.sMYSQLSERVERNAME & ";" & _
"PORT=3306;" & _
"DATABASE=" & mdlConst.sMYSQLDATABASENAME & ";" & _
"USER=" & mdlConst.sMySQLUSERNAME & ";" & _
"PASSWORD=" & sPassword ' & ";"
For i = 0 To CurrentDb.TableDefs.Count - 1
If (CurrentDb.TableDefs(i).Connect <> "") Then
CurrentDb.TableDefs(i).Connect = sConnect
CurrentDb.TableDefs(i).RefreshLink
End If
Next
But the MySQL ODBC Configuration still pops up asking for the username
and password.
Interestingly, the CurrentDb.TableDefs(i).Connect does not have the
user name or password in the string after the CurrentDb.TableDefs
(i).RefreshLink command.
I've also tried UID and PWD instead of USER and PASSWORD, without
success.
Am I missing something? I'm not trying to change the table link, I
just want to set the username and password through the code instead of
having someone have to use the configuration pop-up.
Thanks,
Nik