0

i'm trying to "compile" an Access ADP file to obtain an ADE with a small vbs script.

Option Explicit

Const acCmdMakeMDEFile = 603
Const msoAutomationSecurityLow = 1
Dim AccessADP
Set AccessADP = CreateObject("Access.Application")
AccessADP.AutomationSecurity = msoAutomationSecurityLow
AccessADP.visible=false
AccessADP.OpenCurrentDataBase(SourceOfADP)

I need to call one sub and one function which are written inside the ADP...for the sub no problem

AccessADP.Run "nameOfTheSub"

but i'm not able to use the function (that has to return one numeric value). The Access function is very simple

public function getValue() as Integer
    getValue=10
end function

none of these solutions works for me

dim returnValue
set returnValue = AccessADP.Run "getValue"


dim returnValue
returnValue = AccessADP.Run "getValue"

any ideas to catch the return value from the function from vbs?

thanks in advance

Erik A
  • 31,639
  • 12
  • 42
  • 67
teoooo78
  • 19
  • 5

1 Answers1

2

As you want to

  1. get the return value of a function
  2. expect a non-object return value

use

dim returnValue
returnValue = AccessADP.Run("getValue")

mark the param list () - see here - and the missing Set - see here.

Community
  • 1
  • 1
Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96