1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Dim db As DAO.Database, tdf As DAO.TableDef, Rel As Relation
Dim iTb As Variant, nomtb As String
Dim Msg, Style, Rep As String
Set db = CurrentDb
' Recherche du nombre de tables, sauf tables systeme
iTb = 0
For Each tdf In db.TableDefs
nomtb = tdf.Name
If Left(nomtb, 4) <> "MSys" Then iTb = iTb + 1 ' Non prise en compte des Tables Système
Next tdf
Msg = " Nombre de Tables Trouvées : " & iTb & " Voulez-vous les migrer vers MySQL ? "
Style = vbQuestion + vbYesNo + vbDefaultButton2
Rep = MsgBox(Msg, Style)
If Rep = vbNo Then Exit Sub
' Migration des Tables, sauf tables système
iTb = 0
For Each tdf In db.TableDefs
nomtb = tdf.Name
If Left(nomtb, 4) <> "MSys" Then
Me!Tbencours = nomtb
Me.Requery
DoCmd.TransferDatabase acExport, "ODBC Database", _
"ODBC;DATABASE=BLVLTest;DSN=BLVLTestMySQL;UID=root;PWD=", acTable, nomtb, nomtb
iTb = iTb + 1
End If
Next tdf
MsgBox " " & iTb & " Tables Migrées "
Set db = Nothing |
Partager