Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the macros back as they vanish somehow in a AccessDB?

Status
Not open for further replies.

feipezi

IS-IT--Management
Aug 10, 2006
316
US
Hello folks,

I have an AccessDB with a size of abound 30 MG. There are tons of macros in it. I am responsible for running some production jobs at the beginning of a month. A few associates did the similar thing a few days ago. As I took over, I found none of the butotns, back up by some macros, were not working. As I use Alt/F11 to check them, there were none.

I do have more than one backup copies of the DB. But they are from the previous months. If I take one of them, the monthly update of the latest month won't exist. I need probably re-run all the macros to keep them update.

I thought about import the macros from the previous backup copies into my current corrupted DB file. This is what I did:

first open the problem DB, the one has no macros;
then
Goto External Data then New Data Source then From Database: Access then specified the pathh of my decent DB file, the file has macros; then click OK then start copying; after done, but I don't see macros in the Tool dropdown, except for one: Autoexecute macro.

No idea what's going on.
Please advise.
Thanks.
 
Maybe the opposite: copy new data to old database would be simpler if it is only problem of new data? In this case new tables can be imported to old database, access automatically changes names of imported table adding '1' at the end if both tables have the same name. When the imported table is renamed and suffix removed, access asks if old table has to be replaced by new one. Confirm, compact&repair database.

Why not split the database to FE nad BE and separate data and application in the future?


combo
 
Thanks combo for the quick response!

I can certainly try what you suggested. But the old (or the problematic DB) has no macros any more. It means I need another similar DB where macros are residing to be the source so I can copy the macros over to the new DB, correct?

Btw, after I copied the macros over to the problematic DB, like what you said, each macro has '1' as a suffix. Does that mean the macros were already in the DB, didn't disappear, just hiding somewhere. But where?

Thanks again.

 
It could be the macros are hidden. You can view hidden objects from the File-Options-Current Database-Navigation Options-Show Hidden Objects.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
I meant, if it is possible: copy data from new database (with data only) to (copy of) backup copy with macros. You will get old macros with new data.

However, if copies are renamed, macros seem to still exist, as dhookom suggests.

combo
 
Hello dHookom

I tried your way but did see any hidden macros. I will keep checking because the size of the DB is bigger than expected. I still suspect there be some old macros hidden somewhere.

Hey combo, I understand what you recommended. But the fact is the new data is supposed to be created and processed by those macros. If you can see the attached snapshot. It's only one of the tabs. It's the tab of Imports.

Thanks.
 
 https://files.engineering.com/getfile.aspx?folder=d48d2979-6a8b-4f35-adc9-1ae5b6c4c472&file=Capture.PNG
I am a bit confused.
I understood that your recent database has no macros (i.e. at least VBA, as you checked this in VBE), with recent data from May. You have older copies, working, latest with April data. I am right?
Are you an author of the database? Does it use only VBA code or Access macros too? In the latter case, can you see macros?
There is a multipage menu on the form, is it still displayed? If so, you can see a form without part of buttons? ('I found none of the butotns, back up by some macros, were not working.' Any message, if you can see and click button?)

If only your menu form is corrupted or VBA code removed (full modules only code), you can try to import a form or module from archive database. In VBA old modules (if still exist) should be deleted, new renamed if necessary. New form can be renamed and set as startup form if necessary.





combo
 
Hello combo, please see my comments below, in upper case.

I understood that your recent database has no macros (i.e. at least VBA, as you checked this in VBE), with recent data from May. You have older copies, working, latest with April data. I am right?

YES, YOU'RE RIGHT. I'M RUNNING JUNE DATA BUT SOMEHOW THE MACROS ARE GONE, I.E., FROM THE DROPDOWN OF TOOLS->MACROS, I HAVE ALMOST ZERO MACROS; THEN I IMPORTED THE MACROS FROM MAY DB, TWICE, SO THE MACROS HAVE '1' AND '2' AT THE END OF EACH MACRO. IN ANOTHER WORD, THE MACROS ARE RENAMED. PROBABLY DUE TO RENAME, CLICKING ANY OF THE MACROS, IT WON'T RUN

Are you an author of the database? Does it use only VBA code or Access macros too? In the latter case, can you see macros?
There is a multipage menu on the form, is it still displayed? If so, you can see a form without part of buttons? ('I found none of the butotns, back up by some macros, were not working.' Any message, if you can see and click button?)

NO. I AM JUST A USER OF THE DB. THE DB HAS ABOUT OVER 2,500 TABLES AND QUERIES, BUILT BY A GROUP OF PEOPLE. AS CLICKING THE BUTTONS, AFTER IMPORTING THE MACROS, THERE IS NO REPONSE AT ALL. I AM MORE OR LESS A EXCEL MACRO GUY, NOT AN ACCESS ONE.

If only your menu form is corrupted or VBA code removed (full modules only code), you can try to import a form or module from archive database. In VBA old modules (if still exist) should be deleted, new renamed if necessary. New form can be renamed and set as startup form if necessary.

ARE YOU WANTING ME TO RENAME THE MACROS ON THE SNAPSHOT? I GUESS I NEED A MACRO TO DO THAT. I THINK I HAVE A FEW HUNDREDS OF THEM.

Thanks a lot, combo.
 
 https://files.engineering.com/getfile.aspx?folder=fd4148b3-5f70-4278-8ef3-debe0cf30df4&file=Capture.PNG
I would try to remove bad modules and import good from old database. Both deletion and import is possible for multiple objects in single steps. In Access navigation pane, when all objects are displayed and grouped by type, select all objects of a given type and delete all. Under modules there are both modules and class modules. Set to display hidden objects too (for the purpose that they exist and were cleared).

Compact and repair.

If the database still does not work, proceed with forms in the same way.

If some queries, macros or reports are missing, this process can be repeated.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top