I am out of my comfort zone and it shows.
I would like to create a command button that creates an ODBC connection for users automatically. I do not care if it is “on the fly” or if the created connection is now present in their ODBC system connections.
I have 2 tables in the DB that get linked tables and drive everything else.
I have not figured out the linked table issue yet or even if I need to given an ODBC connection may allow the linked tables to connect properly.
The user set is 20 users in 20 different states connecting back to 1 data warehouse.
Please save me from setting up 20 ODBC connections and then the 20 backup people.
What I have so far is:
A command button that looks like this
Private Sub CreateODBC()
On Error GoTo Err_CreateODBC_Click
getMySqlConnectionString
Exit_CreateODBC_Click:
Exit Sub
Err_CreateODBC_Click:
MsgBox Err.Description
Resume Exit_CreateODBC_Click
End Sub
--Then a function that looks like this
Public Function getMySqlConnectionString(ByVal myDatabase _
As String, ByVal blnLinkedTable As Boolean) As String
Dim UserName As String
Dim Password As String
Dim ServerAddr As String
Dim Driver As String
Dim Port As String
Dim strODBC As String
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Provider=SQLNCLI;Server=svrdw;DataBase=sales;"
If blnLinkedTable Then
strODBC = "ODBC;"
Else
strODBC = ""
End If
getMySqlConnectionString = strODBC & "Driver=" & Driver & ";" & _
"svrdw" & ServerAddr & ";" & _
"sales" & myDatabase & ";" & _
"What Port is MS SQL DB????" & Port & ";" & _
"Testuser" & UserName & ";" & _
"testuserpassword" & Password & ";" & _
"Option=3;"
End Function
As you can see this does not work. I made changes and assumptions that are beyond my skills. Also I have no idea what port to use.
Thanks for any help
I would like to create a command button that creates an ODBC connection for users automatically. I do not care if it is “on the fly” or if the created connection is now present in their ODBC system connections.
I have 2 tables in the DB that get linked tables and drive everything else.
I have not figured out the linked table issue yet or even if I need to given an ODBC connection may allow the linked tables to connect properly.
The user set is 20 users in 20 different states connecting back to 1 data warehouse.
Please save me from setting up 20 ODBC connections and then the 20 backup people.
What I have so far is:
A command button that looks like this
Private Sub CreateODBC()
On Error GoTo Err_CreateODBC_Click
getMySqlConnectionString
Exit_CreateODBC_Click:
Exit Sub
Err_CreateODBC_Click:
MsgBox Err.Description
Resume Exit_CreateODBC_Click
End Sub
--Then a function that looks like this
Public Function getMySqlConnectionString(ByVal myDatabase _
As String, ByVal blnLinkedTable As Boolean) As String
Dim UserName As String
Dim Password As String
Dim ServerAddr As String
Dim Driver As String
Dim Port As String
Dim strODBC As String
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Provider=SQLNCLI;Server=svrdw;DataBase=sales;"
If blnLinkedTable Then
strODBC = "ODBC;"
Else
strODBC = ""
End If
getMySqlConnectionString = strODBC & "Driver=" & Driver & ";" & _
"svrdw" & ServerAddr & ";" & _
"sales" & myDatabase & ";" & _
"What Port is MS SQL DB????" & Port & ";" & _
"Testuser" & UserName & ";" & _
"testuserpassword" & Password & ";" & _
"Option=3;"
End Function
As you can see this does not work. I made changes and assumptions that are beyond my skills. Also I have no idea what port to use.
Thanks for any help