aka_BigRed
New member
- Local time
- Today, 14:02
- Joined
- Aug 29, 2007
- Messages
- 7
I have a little automatic updater that checks a central server location and imports new versions of tables/queries/forms, etc to keep all instances of my MS Access database in sync. It has been working flawlessly.
I decided to rework some code and make some global functions in a separate module. For whatever reason, I can't seem to get the modules to import with the correct name. First it deletes the old object and then it imports the new one. The only problem is it won't use the correct name, it somehow thinks the original still exists (after being deleted) and renames the new import to oldModule1
How do I remove the module programmatically using VBA so that when it imports the new copy with same name it keeps the name instead of renaming?
Module to import: someModule
It runs, deletes someModule, imports the new version of someModule from the server but then still renames even though there's no naming conflict.
After running, someModule1 exists, and someModule does not exist
Help! I need a solution to roll this out ASAP!!
example code snippet:
I decided to rework some code and make some global functions in a separate module. For whatever reason, I can't seem to get the modules to import with the correct name. First it deletes the old object and then it imports the new one. The only problem is it won't use the correct name, it somehow thinks the original still exists (after being deleted) and renames the new import to oldModule1
How do I remove the module programmatically using VBA so that when it imports the new copy with same name it keeps the name instead of renaming?
Module to import: someModule
It runs, deletes someModule, imports the new version of someModule from the server but then still renames even though there's no naming conflict.
After running, someModule1 exists, and someModule does not exist
Help! I need a solution to roll this out ASAP!!
example code snippet:
PHP:
If AddEdit = "Edit" Then
place = "ErrDelete"
If TypeChg = "query" And ObjectExists(acQuery, NameChg) Then
DoCmd.DeleteObject acQuery, NameChg
End If
If TypeChg = "Table" And ObjectExists(acTable, NameChg) Then
DoCmd.DeleteObject acTable, NameChg
End If
If TypeChg = "Form" And ObjectExists(acForm, NameChg) Then
DoCmd.DeleteObject acForm, NameChg
End If
If TypeChg = "Report" And ObjectExists(acReport, NameChg) Then
DoCmd.DeleteObject acReport, NameChg
End If
If TypeChg = "Macro" And ObjectExists(acMacro, NameChg) Then
DoCmd.DeleteObject acMacro, NameChg
End If
''''''''''''''''''''''''''''''''''''''''
If TypeChg = "module" And ObjectExists(acModule, NameChg) Then
DoCmd.DeleteObject acModule, NameChg
End If
''''''''''''''''''''''''''''''''''''''''
End If
''Imports the new/edited table, query, etc from the master file on server
place = "Import"
If TypeChg = "query" Then
DoCmd.TransferDatabase acImport, "Microsoft Access", _
masterloc, acQuery, NameChg, NameChg
End If
If TypeChg = "table" Then
DoCmd.TransferDatabase acImport, "Microsoft Access", _
masterloc, acTable, NameChg, NameChg
End If
If TypeChg = "form" Then
DoCmd.TransferDatabase acImport, "Microsoft Access", _
masterloc, acForm, NameChg, NameChg
End If
If TypeChg = "report" Then
DoCmd.TransferDatabase acImport, "Microsoft Access", _
masterloc, acReport, NameChg, NameChg
End If
If TypeChg = "macro" Then
DoCmd.TransferDatabase acImport, "Microsoft Access", _
masterloc, acMacro, NameChg, NameChg
End If
''''''''''''''''''''''''''''''''''''''''
If TypeChg = "module" Then
DoCmd.TransferDatabase acImport, "Microsoft Access", _
masterloc, acModule, NameChg, NameChg
End If
''''''''''''''''''''''''''''''''''''''''