Solved

Replace a Module in Access Database

Posted on 2013-11-08
7
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

691 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