UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd Transferdatabase, Access 2016    
 
   
robleh7
post Jun 12 2018, 06:45 PM
Post#1



Posts: 109
Joined: 27-June 13



I've got a very simple VBA module which imports a series of tables from an older Access database in MDB format to later Access database in ACCDB format. Here is the module:
Option Compare Database


' ImportUserDataFile
'------------------------------------------------------------
Function ImportUserDataFile()
On Error GoTo ImportUserDataFile_Err
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblPhysician", "tblPhysician", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblUserTOICode", "tblUserTOICode", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblWorkercompensation", "tblWorkercompensation", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblClaimAdministrator", "tblClaimAdministrator", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblEstablishment", "tblEstablishment", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblEmployer", "tblEmployer", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblEmployee", "tblEmployee", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblDepartment", "tblDepartment", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblEstablishmentEmpInfo", "tblEstablishmentEmpInfo", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblCost", "tblCost", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblHospital", "tblHospital", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblNote", "tblNote", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblCarrier", "tblCarrier", False
DoCmd.TransferDatabase acImport, "Microsoft Access", "c:\FirstReport10\1reportdata.mdb", acTable, "tblUserCOICode", "tblUserCOICode", False
Beep
MsgBox "First Report 10 will close to process imported tables", vbOKOnly, "Database Update"
DoCmd.RunCommand acCmdCloseDatabase


ImportUserDataFile_Exit:
Exit Function

ImportUserDataFile_Err:
MsgBox Error$
Resume ImportUserDataFile_Exit

End Function

This process imports and duplicates the tables that exist in the new database. There two options I need to be added to this module:
  • Have the imported tables overwrite the existing tables in the database.

  • Insert an input parameter to allow a user to point to where their MDB file is located on their system (could be on a hard disc or network drive)

This code would precede the doCmd of course. I am imagining a string variable with a dim statement and some structure to access the user's network or localhost directories. Then some setting that allows overwriting the existing database objects (the tables). The second option is the most difficult for me to get done.
Go to the top of the page
 
stevep
post Jun 12 2018, 07:54 PM
Post#2



Posts: 76
Joined: 9-November 14



deleted, couldn't format message line breaks, don't know how to just delete the post
This post has been edited by stevep: Jun 12 2018, 08:09 PM
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd October 2018 - 10:21 AM