Link to home
Start Free TrialLog in
Avatar of William Togno
William Togno

asked on

Access Issue, user auto Exec, Runcode Error 2001

Hello All,

Even though I'm new to access, things were progressing well, but I've hit the wall with a few issues.  I've inherited a split database with four pieces, backend version, frontend version and two user versions in accde form.  The users wanted some changes, so I needed to add a few forms, modify a few forms, add a table and come up with the queries for the changes.  That work is complete and working well, but I wasn't able to convert the new frontend accdb version to the user accde versions.  I'm getting an AutoExec, Runcode Error 2045.  As a temporary solution for the users I posted the accdb versions, but most are getting a AutoExec, Runcode Error 2001.  Some of the users are able to open the database, but all the team members need to be able to get in.  I'm wondering what the differences  would be between the users who are able to get in and those that aren't.  I've added the location to the trusted sites and I've changed there macro settings with no success.

Any thoughts would be appreciated, thanks, Bill
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

If you cannot convert to a compiled accde file, you first need to determine why. Make a backup of your database, then do this:

1. Open the VBA Editor
2. Click Debug - Compile

If you have any coding errors, you'll receive a message that gives you details of the coding error. Fix that, and continue doing the two steps above unti the Compile option is disabled.

Error 2001 is "You cancelled the previous operation". This essentially means that Access tried to perform some operation, but could not do so because something that occured prior to that failed.

Error 2045 is "The command line you used to start Microsoft Access contains an option that Microsoft Access doesn't recognize." I assume you are NOT starting Access from the command line, and instead are just double-clicking the database to start it? If so, you may be experiencing corruption. To fix that:

1. Make a backup of your database
2. Compile the database (see above)
3. Compact the database.

Test that, and see if it works, and if you can create the accde from that. If not, create a new, blank database and import everything into that database.

Also, when sharing an Access database, you must make sure that each user has their OWN LOCAL copy of the Frontend. This means a file that is installed directly on their desktop, and NOT shared from a network link. Each of those local copies should connect to the same Backend database (where the data is located).

Be sure that all users have full permissions on the FOLDER hosting your backend database. Users must be able to read/write/create/destroy in that folder. You can test this by trying to navigate to that directory and create a small text file, and then delete that text file. If you can do that from each user's workstation, then their permissions are generally correct.
Avatar of William Togno
William Togno

ASKER

Hi Scott,

Thanks for the advice, but I tried the Debug and Compile and the Compact and Repair with no luck.  It converts, but when I try and open the accde version of database I get an Error Code of 2425.

As for the final solution; the previous location of the accde user versions was on a network drive, was connected to the backend and worked fine.  Is there a reason why that would be a problem going forward?

Keep in mind you're dealing with a novice.

Thanks, Bill
Error 2425 is "The expression you entered has a function name that Microsoft Access can't find". That generally means you're calling a Function or Sub, but you don't have it named correctly. This should have been caught when you Compile the database.

Or are you getting this error on the end user machine, and NOT your development machine? If so, then you may have invalid references. Can you show a picture of your references? To do that, open the VBA Editor and click Tools - References.
Is there a reason why that would be a problem going forward?
It's not the right way to deploy an Access database, and just because it worked "in the past" is not a good reason to keep it that way - especially as newer versions of Access come out. While older versions could co-exist pretty well, newer versions are not the same. Trying to run an Access app in 2013, while someone else tries to run the SAME file in 2016, can cause all sorts of issues.

Also, you must do your development work on a machine running the "lowest common denominator" you expect to support. If you have users running 2010, 2013, and 2016 you must do your work on a machine running 2010. Access can upsize references correctly, but it cannot downsize.
Hi Scott,

The error when attempting to open the database after converting is on my machine,  The attachment has the screenshot to the references.  Any insight into why some users are able to open the database with no issues and some are getting the 2001 RunCode Error.

Thanks again, Bill
Access-References.docx
I'd suggest you import to a new, blank database. To do that:

1. Create a backup of your database
2. Create a new database
3. In the new database, click External Data >> Import & Link >> Access, and follow the prompts to import everything from the old database into the new.

Your references look fine, assuming your end users all have Access 2016 installed on their machines.
Hi Scott,

Did that and now when I Debug and Compile it stops and highlights a line in yellow.

db.Properties("AllowSpecialKeys") = False
You don't have that property in the database (it's not there by default). To enable it, open the database, then click Options >> Current Database, check the 'Use Access Special Keys' option.
Hi Scott,

Did that and the box is checked, but when I Debug and Compile it keeps going back to the same line of code about 'Special Keys'.  One note, now I'm getting an Auto Exec RunCode Error of 3270 when I try to open the database.  I've done some research, but haven't found anything useful and attached a screenshot that might help.

And, yes, all the user have Access 2016.

Thanks again, Bill
Error-Number-3270--AutoExec--RunCod.docx
Comment out that line - put a single quote in front of it. Try running it again.

Are you doing this on a machine running 64-bit Office, or 32-bit Office (NOT the operating system bit-ness, but the Office bit-ness)?
Hi Scott,

When I comment out the db.Properties("AllowSpecialKeys") = False line of code the Debug/Compile becomes gray and I'm not able to make the selection.  32 bit for Office 365.

Thanks, Bill
Did the Compile button disable AFTER you clicked it? That's what it's supposed to do if your code compiles correctly.
Hi Scott,

I did another import to a blank database and from there Debug/Compile stopped again on a similar line of code in a different location:   db.Properties("AllowSpecialKeys") = True

That block of code looks like this;

Private Sub btnShowNav_Click()
DoCmd.SelectObject acTable, , True
Set db = CurrentDb()
db.Properties("AllowSpecialKeys") = True
Set db = Nothing
DoCmd.ShowToolbar "Ribbon", acToolbarYes
End Sub

I came across this exchange, which looks like it may apply, but to be honest...  don't really know how to make it work.

http://www.accessforums.net/showthread.php?t=61105

Appreciate the help, Bill
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.