Autoexec macro error on runcode Results

(edit: forgot to say, I'm using Access 2003)
I have an Autoexec macro that uses RunCode to call a VBA function.
It works fine on one PC, in MDB or MDE.
On another PC I'm trying to run it on, it works fine as a MDB but gives an error when I open the MDE version:
"The expression you entered has a function name that Microsoft Office Access can't find"

I have tried making the function Public, but that has no effect.

If I convert it (MDB to MDE) on the second PC, it will run, but I don't have the code-signing certificate set up on that PC, and shouldn't have to just to get it working!

edit: just had an idea... tried putting the function call in a form's OnLoad, and having that form open on startup instead of the macro... still doesn't work. Brings up a different error:
"the expression on load you entered as the event property setting produced the following error:
requested type library or wizard is not a vba project.
* the expression may not result in the name of a macro, the name of a user-defined function, or [event procedure].
* there may have been an error evaluating the function, event, or macro."

autoExec macro headache
I picked up the following code from this site:

'This Code disables the shift key
'**********************************
Public Sub SetAllowByPassKeyProperty()
Dim db As Database
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append prp
End Sub

It’s meant to disable the shit key when somebody logs on to access, I’ve plaec it in a standard code module & it’s called by the below function:

Public Function callAllowByPassKeyProperty()
Call SetAllowByPassKeyProperty
End Function

The above function is stored in an AUTOEXEC macro made up of a single runCode action, the callAllowByPassKeyProperty() is the only function name provided as the argument.

When I run the database I get the following run time error ‘Can’t append – an object with that name already exists in the collection – run time error 3367’

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??

Hello Everyone......

I am facing above problem from last 2 months but I coldn't find out the solution....If anybody face this problem and work around it....help me.

I am using this application on my desktop which configured :
Windows XP SP3 ,MS Office 2007, 2 GB RAM and this is working fine with out problem.
But when I try to run this application on my Laptop which configured :
Windows 7 64 bit,MS Office 2007,3 GB RAM It show me error on startup.

=> ERROR DESCRIPTION
Run-time error '2004':
There isn't enough memory to perform this operation.Close unneeded programs and try the operation again.
In Action Failed error box detain
> Macro Name : AutoExec
> Condition : True:[CurrentProject].[IsTrusted]=True
> Action Name : RunCode
> Agruments : runMain() > Error Number : 2950

I have lots of application loaded on my laptop and it is consuming averagely 1.94 GB RAM but thenever I have 1 GB free to run any operation.
when I start this application my ram In Use 2095 MB (2.6GB) thenever I have 868 MB standby and 17 MB free.
here my cached size is 891 MB and I have available 893 MB.

The macro performing Initialization in Main procedure which call during startup through AutoExec macro.

************************************************** *********************************
Public Sub initializeProject()

--> Set Objects(ProjectIndex) = New MainObject 'Error Line
With Objects(ProjectIndex)
.setObjectName "Project"
.setTableName ProjectTableName
.setMainObjectIndex ProjectIndex
.setIDColumn "ID"
.setPublishedColumn "Name"
.setColumnNamesSize 4

.setColumnNamesValue 0, "Des", "Description:"
.setColumnNamesValue 1, "FNm", "First Name:"
.setColumnNamesValue 2, "LNm", "Last Name:"
.setColumnNamesValue 3, "Nm", "Number:"
.setColumnNamesValue 4, "Dt", "Date:"

End With
End Sub

************************************************** ***************************************
Here Objects is
'OBJECT ARRAY VARIABLES:
'Array of Main Objects, (see MainObject Class for detailed description), can be accessed from anywhere in Project
' Each Index within the array refers directly to a type of Main Object
Public Objects() As MainObject

Here MainObject is
'TYPE: CLASS
'NAME: MainObject
'Purpose: Class Inherited from the logical-only class "Table". Any primary table within the application.
that exists as relevant records with columns and has relationships with with other primary objects.
The code contains properties of the Access table and indexes references for the Sub- and SuperOjects of the MainObject,
a FormGroup Object and contains/generates lists of data that are displayed on each type of form. It contains get and set
methods for each property as well as intermediary calls between the rest of the project and FormGroup methods.
Here ProjectIndex is
'TYPE: Enum
'NAME: ICMainObjectIndex
'Parameters: None
'Purpose: index for the main objets

Enum ICMainObjectIndex
SubIndex = 0
ModelIndex = 1
baseIndex = 2
ProjectIndex = 3
VisioIndex = 4
capIndex = 5
End Enum

The important thing is I am using here in application Visio,Excel,Word references to get on call.

I cann't understand how to solve this....please guid me in proper direction.....

Thanking u in advance.

I am attempting to deploy a runtime version of a 35 user Access 2007 system using SQL Server at the back-end to Windows 2008 Server with terminal services.

So,
I can create a runtime package (.accde) for the application using Access 2010. I can run the runtime file locally without any problems I can run the runtime file on a Windows 2008 server with terminal services and a full install of MS Office 2010 without problems. I do get the Microsoft Security Access Warning about not being able to ensure it is from a trustworthy source but can OK through that and the application runs.
However ...
If I remove the full Office install and try to run the application using the Access 2010 runtime only then I get the same security warning but following that then the macro step debugger appears with an error (see below) The only option available at this point is to stop the application. I have added a simple dialog box at the beginning of the AutoExec function which appears when run locally but not when running on the server.
Error details:

Macroname: AutoExec
ActionName: RunCode
Arguments: Autoexec()
Error Number: 2001

Does anyone have any ideas what might be causing this or how I can go about diagnosing the problem.

Thanks in advance

Neil


Not finding an answer? Try a Google search.