MS-Access: how to run macros from w/i PB?

Just starting out? Need help? Post your questions and find answers here.
kalau
New User
New User
Posts: 2
Joined: Wed May 11, 2005 9:58 am
Location: Germany

MS-Access: how to run macros from w/i PB?

Post by kalau »

Hello all,

I wonder whether and how it's possible to run/start a macro inside an Access-database.

Background: I coded several macros in MS-Access (which e.g. print letters using forms within Access)
and simply want to start them from within my PB 3.94-database application.

There need not be any "feedback" to my application, a simple call or click to execute the macro will be sufficient.

Is this possible?

Any snippet or idea will be welcome.

Thanks in advance!
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

Messed with access specific things and came with no solution.
Although you might want to try CREATE PROC SQL stuff.
It does create a query item but with specific SQL doings.
Maybe?
User avatar
the.weavster
Addict
Addict
Posts: 1581
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Post by the.weavster »

This is not a great solution but it will work:

If you create a macro called 'AutoExec' it runs when you first open Access, if you make this a conditional macro it could look up a value in a table and perform a certain function based on what it finds.

So your PB app would write a value to the Access table then launch the database, the AutoExec macro would perform the function associated with the value you have written to the table then quit.



This is a more elegant solution:

If it's just reports you require check out ComponentOne, you can convert reports you have created with MS Access to an XML template. Then it has an ActiveX control that will not only print the report but can output it in a multitude of different formats (*.rtf, *.pdf, *.htm etc...)
User avatar
the.weavster
Addict
Addict
Posts: 1581
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Post by the.weavster »

I was just looking at www.PureArea.net and noticed in the libraries section there is a library for utilising the MS ScriptControl.

So, you should be able to use MS Access as an Automation Server.

In Access create a module that contains a public procedure that prints your report (I don't think you can call code that's in forms), then you can call this procedure from a script using the ScriptControl library.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

On german forum ScriptControl lib for PB4 (OpenSource beta):
http://www.purebasic.fr/german/viewtopi ... iptcontrol
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply