Running Function from Toolbar

sgtSortor

Registered User.
Local time
Today, 14:45
Joined
Mar 23, 2008
Messages
31
I'm trying to open a different database from within the current database. If I do this from a button, this works beautifully. But if I try and use it from my toolbar, I get an error message:

"SHIP (Investments Project) can't find the name 'rptProblem' you entered in the expression"

as you see below, that is the correct name of the function I'm trying to call.

Code:
Public Function RptProblem()
    Dim strDB As String

    ' Initialize string to database path.
    Const IssuesDB = "T:\Wisha db\Training & Outreach\Issues.mdb"

    strDB = IssuesDB & "Issues.mdb"
    ' Create new instance of Microsoft Access.
    Set appAccess = _
        CreateObject("Access.Application")
    ' Open database in Microsoft Access window.
    appAccess.OpenCurrentDatabase strDB
    ' Open Orders form.
    appAccess.DoCmd.OpenForm "frmSignIn"

End Function

Thanks for any help.
 
Running Function From Toolbar

OKAY, FOUND THE PROBLEM. I forgot the () after the function name. It works beautifully now.
 
If that function in a standard module? If so, what is the name of the Module? What exactly do you have in your ToolBar to execute this function?
 
I changed the function to a much shorter one,

Code:
Option Compare Database
Dim objAccess As Access.Application


Public Function RptProblem()

    Application.FollowHyperlink "T:\Wisha db\Training & Outreach\Issues.mdb"

End Function

On the toolbar, I added a custom button and on the button properties on

Action: =rptProblem()

This opens a database I have for all of my users to report any problems they might have in all of the databases that I have control over.
 

Users who are viewing this thread

Back
Top Bottom