vba

Import objects from another database in Access VBA

Import objects from another database in Access VBA

Introduction This article covers the ways for importing Tables, Queries, Modules, Forms and Reports in Access VBA. Import Tables, Queries, Modules, Forms and Reports Public Sub ImportAllObjects(ByVal filePath As String) Dim currentTable As TableDef Dim currentQuery As QueryDef Dim dc As Document Dim dbs As DAO.Database Set dbs = OpenDatabase(filePath) 'Import Tables except System Tables For Each currentTable In dbs.TableDefs If Left(currentTable.Name, 4) <> "MSys" Then DoCmd.TransferDatabase acImport, "Microsoft Access", filePath, acTable, currentTable.Name, currentTable.Name, StructureOnly:=False End If Next 'Import Queries For Each currentQuery In dbs.QueryDefs DoCmd.TransferDatabase acImport, "Microsoft Access", filePath, acQuery, currentQuery.Name, currentQuery.Name Next 'Import Modules For Each dc In…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.