Stuart McLachlan
stuart at lexacorp.com.pg
Sat Mar 9 16:04:29 CST 2013
You can strip the following code down to a single DoCmd.TransferDatabase...... I'll leave that as an exercise for the reader :-) Const strMySQLConnect = "ODBC;......... Function ConnectMySQL() As Long Dim tdf As TableDef For Each tdf In CurrentDb.TableDefs If Left$(tdf.Name, 3) = "tbl" Then renewlink tdf.Name, strMySQLConnect, False End If Next End Function Function renewlink(tablename As String, datafile As String, AccessDb As Boolean) As Long On Error Resume Next DoCmd.DeleteObject acTable, tablename On Error GoTo 0 Select Case AccessDb Case True DoCmd.TransferDatabase acLink, "Microsoft Access", datafile, acTable, tablename, tablename, False Case False DoCmd.TransferDatabase acLink, "ODBC Database", datafile, acTable, tablename, tablename, False End Select End Function -- Stuart On 9 Mar 2013 at 15:36, Arthur Fuller wrote: > I have the string itself. I'm not sure how to use it. New connection object > and assign the string to it? Normally I've used DSNs to connect, but I need > to learn how to do it DSN-lessly. > > TIA > > -- > Arthur > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >