Question status:
I no longer think that it is important that I refer to Excel or that the query has parameters. I think the question boils down to this: how can I use an Access query that uses the functions defined in Access-VBA in Word VBA?
What I want to do is impossible , how can I make a built-in version of the Acos function with my request, according to shahkalpesh's answer ?
I have a function in Access VBA:
Public Function Acos(radians As Double) As Double
Acos = WorksheetFunction.Acos(radians)
End Function
WorksheetFunction comes from an excel link (which I do simply because it defines an acos function).
I use this function in a query that has three parameters. Then I run this query in Word VBA as follows:
Dim command As New ADODB.command
With command
.ActiveConnection = connection
.CommandText = "MyQueryName"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter( _
"Param1", adDouble, adParamInput, , param1Value)
.Parameters.Append .CreateParameter( _
"Param2", adDouble, adParamInput, , param2Value)
.Parameters.Append .CreateParameter( _
"Param3", adDouble, adParamInput, , param3Value)
End With
Dim records As New ADODB.Recordset
records.Open command, , adOpenKeyset, adLockOptimistic
Word VBA, Acos .
?
UPDATE
: , Access.
, , Office 2007.
2
Access to Word, VBA Word, , VBA .
Excel .
3
Excel Word Access. ( acos-, , , .)