We use a switchboard in Access 2003.
I want to be able to open a query that is in another database, the query accepts two date parameters. I created the code provided below, but when I click the switchboard button it gives me the following error: "There was an error executing the command."
Yet if I run it directly from the VBA window it runs fine.
What am I doing wrong?
Thank you in advance!
Function ExpectedShipDateQuery() As String
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase "\\myServer\access data\myOtherDatabase.mdb"
objAccess.Visible = True
objAccess.DoCmd.OpenQuery "Expected Ship Date"
Set objAccess = Nothing