I am trying to call a Access 2010 subroutine from Reflection UNIX and OpenVMS. I have a fairly lengthly program that uses early binding with DAO database and recordsets and for now would like keep it as early binding, but I now need to call a sub in Access. The problem is I get an error 7952 "You made an illegal function call" when using early binding. I can get it to work with late binding.
What am I missing?
Access subroutine(starting simple)
Early binding:
Late Binding
Thank you for any suggestions.
You don't know what you don't know...
What am I missing?
Access subroutine(starting simple)
Code:
Public Sub HelloWorld()
MsgBox "Hello World"
End Sub
Early binding:
Code:
Sub RunAccessSubEarlyBinding()
Dim objAccess As Access.Application
Dim db As DAO.Database
Dim dbPath As String
dbPath = "S:\Pharmacy General\Databases Automation\Databases\Inpatient\TeamRounds.accdb"
Set objAccess = New Access.Application
Set db = objAccess.DBEngine.OpenDatabase(dbPath)
objAccess.Run "HelloWorld" '<<Get Error 7952 "You made an illegal function call">>
End Sub
Late Binding
Code:
Sub RunAccessSubLateBinding()
Dim objAccess As Access.Application
Dim dbPath As String
dbPath = "S:\Pharmacy General\Databases Automation\Databases\Inpatient\TeamRounds.accdb"
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase dbPath
objAccess.Run "HelloWorld"
End Sub
Thank you for any suggestions.
You don't know what you don't know...