My DBMS runs perfectly from the .accdb, and compiles without error. But when I try to run the resulting .accde it fails during the Autoexec macro with Error 2425, “The expression you entered has a function name that [application title] can’t find”.
The function call is a RunCode to Public Function Startup(), and it is the only action in the Autoexec macro - see attached document. The function is in a standard module “SystemFunction s”.
The application has been running for over 5 years, and it is only in the last week or so that this problem has surfaced. A backup of the application taken a few weeks earlier still runs perfectly from the .accde. However, there are no changes to either the Autoexec macro or the Startup() function, or to anything called by Startup(), between the two versions.
Testing reveals that Autoexec can successfully open reports, tables, queries, forms etc, but it can’t open ANY RunCode procedures. I have tried various other functions including do-nothing functions, but it can’t find them.
I have seen the Post.Bytes post on this subject dated Aug 26 ’19 by Kledki, and the responses by NeoPa and ADezii. NeoPa asked “Is it in a standard module?”. As far as I can tell, it is. The module is listed in the Modules section at the bottom of the Navigation pane, and in any case it hasn’t changed since the project started years ago. Learn.microsoft .com says “To determine whether a Module object represents a standard module or a class module from code, check the Module object's Type property” but doesn’t say just what to look for in the Type property. The Type property for the SystemFunctions module says “Module (Local)”, which doesn’t make clear to me whether it’s a class module or a standard one, but I’ve always assumed that those modules in the bottom of the Navigation pane are standard modules. In any case, whatever type it is in the .accdb it presumably is also in the .accde, and whatever type it was in the accde two weeks ago it presumably still is.
Since I can’t get at the code of the accde I’m finding it very hard to know how to debug this problem.
The function call is a RunCode to Public Function Startup(), and it is the only action in the Autoexec macro - see attached document. The function is in a standard module “SystemFunction s”.
Code:
Public Function Startup() ' ' Initialises global variables, then checks to see if the back end is linked; if so, open Switchboard; if not, open F74 ' ' Process: ' Get connect string for tbl People from TableDefs ' Extract the path to the linked back end from the connect string ' Check the Windows directory for the specified path ' If it exists, open the main menu; if not, open F74 (which is the only unbound form) ' Dim dbs As Database, tbl As TableDef Dim PathStart As Long, BEPath As String Set dbs = CurrentDb() Set tbl = dbs.TableDefs("People") ' See if People table is linked gblComputerName = VBA.Environ("USERDOMAIN") gblComputerUserName = VBA.Environ("USERNAME") ' User name as recorded in the operating system gblUserName = gblComputerUserName ' User name as recorded in the database, after he has logged on in F01 gblCurrentUser = 0 ' PersonID of current user (initialised to 0 so F74 can tell whether a user has logged in) Call WhichBackEnd Call LogActivity("opened", "DBMS on " & Currently & "data") ' Log the fact that the system has been opened If Not CurrentProject.IsTrusted Then MsgBox "The database file EmmausDBMS.accdb needs to be in a trusted location" Pause (5) Else PathStart = InStr(tbl.Connect, ";DATABASE=") + 10 BEPath = Mid(tbl.Connect, PathStart, 99) ' Path to BE file from the connect string If Len(Dir(BEPath, vbHidden)) > 0 Then ' If there is a linked back end, ... DoCmd.OpenForm "01: Login page" ' then proceed to let the user log in; Else DoCmd.OpenForm "74: Link to back end" ' otherwise, go find a back end; F74 will then open F01 (because gblCurrentUser=0) End If End If Debug.Print "Exiting Startup" End Function
Testing reveals that Autoexec can successfully open reports, tables, queries, forms etc, but it can’t open ANY RunCode procedures. I have tried various other functions including do-nothing functions, but it can’t find them.
I have seen the Post.Bytes post on this subject dated Aug 26 ’19 by Kledki, and the responses by NeoPa and ADezii. NeoPa asked “Is it in a standard module?”. As far as I can tell, it is. The module is listed in the Modules section at the bottom of the Navigation pane, and in any case it hasn’t changed since the project started years ago. Learn.microsoft .com says “To determine whether a Module object represents a standard module or a class module from code, check the Module object's Type property” but doesn’t say just what to look for in the Type property. The Type property for the SystemFunctions module says “Module (Local)”, which doesn’t make clear to me whether it’s a class module or a standard one, but I’ve always assumed that those modules in the bottom of the Navigation pane are standard modules. In any case, whatever type it is in the .accdb it presumably is also in the .accde, and whatever type it was in the accde two weeks ago it presumably still is.
Since I can’t get at the code of the accde I’m finding it very hard to know how to debug this problem.
Comment