Results 1 to 4 of 4

Thread: C/C++ executing an access macro using ADO DAO ODBC whatever...

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Petawawa Ontario
    Posts
    5

    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....

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Petawawa Ontario
    Posts
    5
    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

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width