TransferDatabase optimized with management of errors and progressbar...

J

jtardy

Hi everybody...

for begining i'm french so scuse me for my approximate english...

i use this program to import everyday tables in my database...but i
think it's not optimized, simply,...
could you help me to improve it whith a progressbar during the
execution for exemple and a management of errors, if it can't rename a
table for example, with a msgbox who inform me where there is
mistakes...
i'm a beginner in vba so scuse me an other time for all...

Code :
Private Sub fraImportProd_Click()
'Mise en place du sablier
DoCmd.Hourglass True

'Lancement de l'importation à partir de la source externe
DoCmd.TransferDatabase acImport, "Base de données ODBC",
"ODBC;DSN=GGA60;", acTable, "none.ARTST", "none_ARTST"
' Suppression de la table déjà présente dans la base
DoCmd.DeleteObject acTable, "none_ARTST"
' Renommage de la table importée
DoCmd.Rename "none_ARTST", acTable, "none_ARTST1"

DoCmd.TransferDatabase acImport, "Base de données ODBC",
"ODBC;DSN=GGA60;", acTable, "none.CDIPP", "none_CDIPP"
DoCmd.DeleteObject acTable, "none_CDIPP"
DoCmd.Rename "none_CDIPP", acTable, "none_CDIPP1"
DoCmd.TransferDatabase acImport, "Base de données ODBC",
"ODBC;DSN=GGA60;", acTable, "none.HALOA_DET", "none_HALOA_DET"
DoCmd.DeleteObject acTable, "none_HALOA_DET"
DoCmd.Rename "none_HALOA_DET", acTable,
"none_HALOA_DET1"
'etc...
DoCmd.Hourglass False
End Sub

Thanks...
 
Top