|
-
Nov 7th, 2002, 08:23 PM
#1
Thread Starter
New Member
C/C++ executing an access macro using ADO DAO ODBC whatever...
I have an existing MS ACCESS 2000 database, which uses a macro to update the records from 3 separate text files.
This macro works perfectly.
What I'd like to be able to do, is simply execute the macro from within my C++ code. The only alternative is to populate the db manually.... . which is not exactly the "slickest" of options considering the macro was dead simple to create.
Anyone with any ideas?
btw I don't care what interface/wrapper/whatever you use in your example, I'm just looking for something that will work.
if it matters, this code will eventually be a COM object or ActiveX control and will be accessed through an asp page....
-
Nov 8th, 2002, 08:14 AM
#2
You could use Automation to fire up MS Access and execute the macro there. Since the macro is saved within MS Access that's the only way I see to do this. But it probably won't work for an ASP page.
If the macro is saved as an external VBA file you could convert it to a VBS file and launch it within the windows scripting host. This requires that you rewrite parts of it because the Access VBA environment is slightly different from the WSH environment.
Or you could rewrite the macro in C++ (or VB, which would be more suited for this job). This is of course the hardest, but the most reliable.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 11th, 2002, 06:24 PM
#3
Thread Starter
New Member
no... firing up a running version of access would be a bad thing.... the idea is to make this 'user friendly' (read: id10t proof). Building a program that automates the process, using C++ or even VB and FSO (or whatever) would work, but would be a PITA. When taking the macro out of Access, by way of exporting in to VB code, the code assumes an existing connection to the db.... I'm not sure what this connection is, but I can't seem to coerce VB to perform the same thing (not sure if this is because I don't know what to use as my access method ... DAO, ADO et al... or because I'm not a VB coder...)
If you could shed light on any of this it'd be much appreciated...
Thanks
-
Nov 11th, 2002, 06:49 PM
#4
You could ask in the database forum how to convert the exported macro to a freestanding VBS script.
It's impossible to make something idiot-proof because idiots are so ingenious.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|