My project uses linked tables and pass-through queries to a MySQL Server in our main office. I have put in a check when the first form loads that checks if this database is available. If it isn't, the program notifies the end user, and then disables all controls on the main form.
This project is also to be used by people on the road, and as such will not always have a connection to the MySQL Server. Worst case is that they will be using a 3G Mobile card in the laptop, which would give them an intermittent connection to the Server. I am providing a locally installed, read-only copy of MySQL Server on their computers in a truecrypt protected area, and the means for disabling buttons related to adding or updating information to get around this. What I need, is some method for checking that they can talk to the main MSQL Server, and then fall over to the local if that is not the case.
I have the following sub that should change the ODBC connection string for all the tables, but not all the pass-through queries.
So I need to change this so it changes pass-through ODBC connection strings, and, in another sub, check that it can talk to the remote server, then local server and warn of change, then none and give big warning message. Any thoughts or ideas?
This project is also to be used by people on the road, and as such will not always have a connection to the MySQL Server. Worst case is that they will be using a 3G Mobile card in the laptop, which would give them an intermittent connection to the Server. I am providing a locally installed, read-only copy of MySQL Server on their computers in a truecrypt protected area, and the means for disabling buttons related to adding or updating information to get around this. What I need, is some method for checking that they can talk to the main MSQL Server, and then fall over to the local if that is not the case.
I have the following sub that should change the ODBC connection string for all the tables, but not all the pass-through queries.
Code:
Private Sub refreshtables(dbname As String) [COLOR=green]dbname is either contacts_local(RO) or contacts_remote (RW)[/color]
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Dim strConn As String
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs
On Error GoTo refErr:
For Each Tdf In Tdfs
If Tdf.SourceTableName <> "" Then
strConn = "ODBC;DSN=" & dbname & "TABLE=" & Tdf.SourceTableName
Tdf.Connect = strConn
Tdf.RefreshLink
End If
Next
refErr:
MsgBox Error & Chr(13) & "couldn't refresh tables"
End Sub
So I need to change this so it changes pass-through ODBC connection strings, and, in another sub, check that it can talk to the remote server, then local server and warn of change, then none and give big warning message. Any thoughts or ideas?