mnashadka
asked on
Running a macro in Access
I have to run a macro in Access (don't ask me why). How can I do this through one of the MFC database classes?
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q194/9/06.asp&NoWebContent=1
Oops, it's not Access. Sorry.
No. You can only get at the tables and queries with the MFC Database classes.
You may be able to do it with automation - but I haven't tried this (also do you really mean a macro or a piece of code in a module).
You may be able to do it with automation - but I haven't tried this (also do you really mean a macro or a piece of code in a module).
ASKER
It could either be a macro or a sub. I figured that macros would be easier. I tried to #import "path\msacc9.olb" to get to the automation, but it gave me some errors about a Property class not being defined. I was also #importing the MSO9.dll and the VBE6EXT.olb (I think those were the extensions, and I tried it with both no_namespace and using namespace after the import, but I couldn't get past that error.
Hi,
You could use DDE(Dynamic Data Exchange) to run a macro in Access. I did it using National Instruments Labview, but I didn't it using MFC. I think it is possible to run macro with MFC too.
Good Luck!
You could use DDE(Dynamic Data Exchange) to run a macro in Access. I did it using National Instruments Labview, but I didn't it using MFC. I think it is possible to run macro with MFC too.
Good Luck!
ASKER
Nass89, could you explain how you did it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
As I wrote, I did it with National Instruments LABVIEW. If you can use DDE, the procedure is the same.
First open a DDE connection to your databse file. Second run a command using Macro name, and finally close the connection.
Can you use DDE ? MSDN hase many article about it.
Good Luck!
As I wrote, I did it with National Instruments LABVIEW. If you can use DDE, the procedure is the same.
First open a DDE connection to your databse file. Second run a command using Macro name, and finally close the connection.
Can you use DDE ? MSDN hase many article about it.
Good Luck!