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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call MS Access Function or Macro from VC++

Status
Not open for further replies.

KeithBrautigam

Programmer
Nov 4, 2000
71
US
I'm looking for a way to call a Sub, Function, or Macro in a Microsoft Access database from C++ code. I would prefer to call a Sub or Function, but a macro could suffice.

I would like to be able to pass a string to the Sub or Function.

For the sake of this question, the database name and Sub/Function name can be hardcoded. Let's say I want to call a function prototyped as "Public Function DoSomething(strRecordWeJustSaved As String) As Boolean" in c:\results.mdb.

The calling application uses MFC and DAO, although it could potentially use ADO or COM or whatever works.

Ideally it would be great to find a solution that didn't involve launching Access (that is, I'd prefer to keep Access from showing up on the task bar), but I would be grateful for any code that gets the job done.

Any solutions would need to work with an Access 2000 database. If they also work with Access 95 or 97, that's great.

Thanks in advance for any help you can provide.
 
> although it could potentially use ADO or COM

Working with the COM interfaces to Access would be the only way to accomplish that. I have no idea if running macros and/or script code is available in the Access Object Model. Check MSDN for more information.

> didn't involve launching Access

That again is determined by the COM implementation of Access and the available Interfaces in the Object Model.

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top