[COLOR="Green"] 'late bound[/COLOR]
Dim obj As Object
Set obj = CreateObject("Access.Application")
[COLOR="Green"] 'early bound - requires a reference to Access[/COLOR]
Dim acc As new Access.Application
Make sure you run the Access.Application.Quit when you are done to ensure you don't leave multiple invisible instances running.
Oh, you mean a user defined function in an Access module. Yeah, that should work. Have you tried it?
The first Parameter is the name of the routine, and then if that routine takes parameters you can pass those in too...
Code:
dim returnvalue as variant
returnvalue = acc.Run("YourRoutineName", YourParam1, YourParam2)
...passes two parameters to a function called "YourRoutineName"
Cheers,
Mark
Do you get that same warning if you open the Access file normally? Maybe you need to go to the OfficeButton->AccessOptions->TrustCenter->TrustCenterSettings->MacroSettings and Enable All Macros.
I'm using Office 2003. I simply set the security level to low in the Access db to get around the issue. There must be a way of enabling the macros at whatever setting it is set using VBA?