Straightforward: Open external database, execute external function

Dugantrain

I Love Pants
Local time
Today, 15:24
Joined
Mar 28, 2002
Messages
221
Hi,
As the Subject line implies, I need to be able to:
1. Open an external database
2. Execute a function in that external database
3. Close the external database

I haven't yet found the code to perform this task, so if anyone could give a hand, that'd be much appreciated.
 
Hey Dugantrain,

I haven't tested this - but I don't think I forgot anything (let me know).

Dim adb As String
Dim dbs As Database
adb = "Microsoft Access"
Set dbs = OpenDatabase("C:\Your_Database.mdb")

On Error Resume Next
dbs.Execute "qryFromYour_Database"
dbs.Close
Set dbs = Nothing

-Sean
 
Criminy, I forgot that you could write a simple query that does nothing but call a specific function (and then, of course, call that query from another db). Yes, that'll do fine, thank you.

*edit* You did forget to declare a Microsoft Access object and then Set it (I believe that's where you were headed with ADB="Microsoft Access"), but I'm pretty sure I know what to do from here.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom