Access Runtime 2010 + Autoexec Macro (1 Viewer)

Tallica

Registered User.
Local time
Yesterday, 18:00
Joined
Jul 27, 2010
Messages
26
I have a database that I have packaged using the package wizard.
I have added the frontend folder location as a trusted site registry key to the package. I have installed this package on several computers with out any runtime errors. I have one satellite office location that gets a runtime error when they open it.

Macro Name: Autoexec
Condition:
Action Name: RunCode
Arguments: OpenCorrectForm()
Error Number: 2001

When the user hits the button "Stop All Macros" which is the only available button, another dialog pops up which says "Execution of this application has stopped due to runtime error."

The autoexec macro calls a function to open an appropriate form based on the users windows login ID.

Here is the code from the module which contains the function

Option Compare Database
Option Explicit
Function GetUserSecLevel() As Integer
GetUserSecLevel = Nz(DLookup("SecurityLevelID", "tblStaff", "[WindowsID]=" & Chr(34) & Environ("username") & Chr(34)), 1)
End Function
Function GetFullUserName() As String
GetFullUserName = Nz(DLookup("FullName", "tblStaff", "[WindowsID]=" & Chr(34) & Environ("username") & Chr(34)), 1)

End Function

Function OpenCorrectForm()
Dim strDoc As String
Dim strUserName As String
strUserName = GetUserName
Select Case GetUserSecLevel
Case 1
strDoc = "GUEST"
Case 2
strDoc = "ERA"
Case 3
strDoc = "TGT"
Case 4
strDoc = "MG2"
Case 5
strDoc = "MCE"
Case 6
strDoc = "HEI"
Case 7
strDoc = "GM"
Case 8
strDoc = "NRA"
Case 9
strDoc = "VAA"
Case 10
strDoc = "MHP"
Case 11
strDoc = "TRC"
Case 12
strDoc = "CTA"
End Select
On Error Resume Next
DoCmd.DeleteObject acForm, "Project List"
DoCmd.DeleteObject acQuery, "goto_qry"
DoCmd.CopyObject , "Project List", acForm, strDoc
DoCmd.CopyObject , "goto_qry", acQuery, strDoc + "_qry"
DoCmd.OpenForm "Project List"
End Function

Any Ideas??
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:00
Joined
Feb 19, 2002
Messages
43,266
The most likely problem is a missing reference on the machine where the code fails. If that PC has a full version of Access, open the app there and examine the references. Then fix the one that is missing.

If you don't have Access installed and can't install it, you either have to figure out manually what library is missing (look at the references defined on your PC and then manually look for them on the target machine) or find some code that identifies the references for you. I don't have any active links and I tried a couple of the suggested solutions but none seemed to work for me. Install any missing libraries.
 

Tallica

Registered User.
Local time
Yesterday, 18:00
Joined
Jul 27, 2010
Messages
26
I included the required references in the package wizard I believe. I will take another look.
 

Users who are viewing this thread

Top Bottom