copy macros to another access DB

Sarameier

New member
Local time
Today, 20:43
Joined
Sep 3, 2021
Messages
26
Dear all...

There is this great macro "for opening a form by click"


My question: Apart from copy & pasting the XML block, is there a way to bringing this macro from one Access DB to another?
 
Import from the database
import.jpg
 
but applying this function: The embedded macro from "on dbl click" would not appear to be copied
1.PNG
2.PNG
 
Did you import the macro or just the form? I do not use macros but modules have to be imported separately even if the form calls it. I assume the same.
 
I tried to import the macro, but there would only the form be available. The thing is that I want to use this macro for other forms other than the inherent one...

I thought there might be a way to just copy paste it to other forms
 
Sorry, I do not know how to do macros. Hopefully someone can help. I sometimes build an autoexec, that is about it. I have never built a macro where you can set the arguments and parameters. If you want reusable code you are likely better off with VBA. Will be a lot easier to get people to help with that.
 
I thought there might be a way to just copy paste it to other forms
Hi. I'm not in front of a computer now, but have you tried selecting the entire macro and then copy and paste it to the other form?
 
If it is embedded, you need to either export the form/report from your DB, or import from new DB?
Alternatively, you can save as a standalone macro and import/export that directly?

You can even just copy the object that runs the embedded macro between DBs. I just tested with a command button.
 
I also never use macros apart from autoexec & autokeys.
However, several years ago I did some research on ways of reading/editing macros using code.

Macros are saved as XML which means there is a lot of 'gobblygook' included.
It is tricky to copy & paste macros to another form (though not impossible)

Effectively, embedded macros are exactly that .... they cannot be copied to another location

You can try the method Gasman suggested but, in the end, you would be better off changing from using macros to VBA code
 
As Colin has said, it is far easier to use VBA.

In this case where you have Multiple Records on a Form, and you need to open another form linked by the specific Primary Key,
it is easier to use the Open Args Method.
 

Attachments

Users who are viewing this thread

Back
Top Bottom