This procedure will transfer an entire module from one database to another. Manually copying objects such as tables, forms, reports, modules etc from one database to another database is simple but unnecessary and time consuming. This can be achieved quickly with this few lines of code. This code is used in MAARS implementation. Feel to free use it in your own program, however, please give proper credit to the MAARS team.
Public Sub TransferAModuleToAnotherDB(srcModuleName As String, destModuleName As String, destDbFullPath As String)
'Export Module definition to the destination database, given in destDbFullPath parameter
If Dir(destDbFullPath) <> "" Then
DoCmd.TransferDatabase acExport, "Microsoft Access", destDbFullPath, acModule, srcModuleName, destModuleName, True
End If
End Sub
This is a complimentary article written by the MAARS team for the MAARS user community. Code in this article drives the operation of MAARS (MS Access Application wRiting Software). MAARS is an intelligent automation program that speeds up MS Access Application Development by 10x, 20x or 100x times. To learn more about MAARS, click here.
Disclaimer:
Some information included in this article may have been sourced from other publicly available websites and blogs. In such cases, credit goes to those authors for the original ideas and thoughts, but we do take credit for putting valuable information together and improve the efficiency of other office developers.