Solved

Replace a Module in Access Database

Posted on 2013-11-08
7
331 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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

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

modExcelbas  without the dot
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

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 119

Expert Comment

by:Rey Obrero
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now