Page 1 of 1
					
				MS-Access: how to run macros from w/i PB?
				Posted: Tue Aug 01, 2006 12:07 am
				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!
			 
			
					
				
				Posted: Tue Aug 01, 2006 3:47 am
				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?
			 
			
					
				
				Posted: Tue Aug 01, 2006 9:00 am
				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...)
			 
			
					
				
				Posted: Tue Aug 01, 2006 2:28 pm
				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.
 
			
					
				
				Posted: Tue Aug 01, 2006 2:39 pm
				by ts-soft
				On german forum ScriptControl lib for PB4 (OpenSource beta):
http://www.purebasic.fr/german/viewtopi ... iptcontrol