Solved

Replace a Module in Access Database

Posted on 2013-11-08
7
342 Views
Last Modified: 2013-11-26
I have a module called modExel. I want to replace this module with a different module with the same name. The new module is modExcel.bas. How do I replace the current module on my database with the new one? I know that you do Alt F11 to open the modules from Access.
0
Comment
Question by:Conernesto
  • 3
  • 3
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39634870
from the database objects window,
select Modules
right click on the module modExel and select copy, then Paste, give it a new name

or just rename your module
right click on the module modExel and select Rename
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39634873
An easy way to do this is to
1.  Make a backup of your existing database before adding the new code

2.  Select ALL and copy all of the code from the new module, and paste it to the old, *overwriting all of the existing code in the original module*

The reason you want to overwrite the existing module is so that you do not have multiple copies of public subs and functions with the same names -- which will cause your code to error on procedure calls because of ambiguous names.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39634874
and, take note that you can not use the name "modExcel.bas", but you can use

modExcelbas  without the dot
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:Conernesto
ID: 39634885
I want to import my new module. When I go to, File Import if I don't have the .bas extension, I cannot select it. When I save it it doesn't save with the same name that I imported. That is why I want to delete the current module and import the new one. How do I do this?
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39634893
Is it from another database?

Or an Excel file?

If a database, use the Get External Data options, and go through the wizard to select the database and module.

If an Excel file, just copy/paste the code from Excel to a new module in Access, and delete the old.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39634896
right click on the module then select delete

File >external data> import > select the access file

then select the module you want to import
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39634900
This is it in Access 2010 -- other versions may look different.  External Data, selecting the Access icon will let you import or export modules, forms, etc from one database to another.

External Data
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question