Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub LinkTable(ByVal myTableName As String, ByVal myDatabase As String)
Dim daoTableDef As dao.TableDef
Dim db As dao.Database
Dim newTable As dao.TableDef
Dim strConnect As String
strConnect = getMySqlConnectionString(myDatabase, True)
Set db = CurrentDb
Set daoTableDef = db.CreateTableDef _
(Name:=myTableName)
With daoTableDef
.Connect = strConnect
.SourceTableName = myTableName
End With
db.TableDefs.Append daoTableDef
Set daoTableDef = Nothing
Set db = Nothing
End Sub
Private 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
ServerAddr = "192.168.1.1"
Port = "3307"
Driver = "{MySQL ODBC 3.51 Driver}"
UserName = {Your User Name}
Password = {Your Password}
If blnLinkedTable Then
strODBC = "ODBC;"
Else
strODBC = ""
End If
getMySqlConnectionString = strODBC & "Driver=" & Driver & ";" & _
"Server=" & ServerAddr & ";" & _
"Port=" & Port & ";" & _
"Database=" & myDatabase & ";" & _
"User=" & UserName & ";" & _
"Password=" & Password & ";" & _
"Option=3;"
End Function