Results 1 to 8 of 8
  1. #1
    atai is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    22

    error 2001 on macro autoexec

    Hello
    I strange thing is appening on my Access program just completed.
    Everything is fine when I run it but if I try to change the name of the database or I move it to another folder I receive an error 2001 opening on macro autoexec.


    Can somebody explain me why.
    Of course I can't keep the program in this way because I need to copy it on the customer's computer
    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    What does your autoexec macro do? Provide code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    atai is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    22
    it simply run a function for disable the tool bars and open the database

    Function disabilita_barra_strumenti() As Boolean


    'Apertura DB
    Set dbsOrdini = CurrentDb


    'disabilitazione barre strumenti
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.ShowToolbar "Status Bar", acToolbarNo
    DoCmd.NavigateTo "acNavigationcategoryObjectType"
    DoCmd.RunCommand acCmdWindowHide
    disabilata_barre_strumenti = True

    End Function



    but even if I remove all the commands I still receive the error.
    Look like all the code created doesn't work anymore

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Does macro do anything other than call this function? I don't use AutoExec macro for this.

    Those features can be set with db Options. Regardless, hopefully you understand either way, settings can be bypassed with pressing shift key while opening.

    Why bother setting dbsOrdini when it is not used?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    atai is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    22
    Even if I disable the autoexec macro I have problem with the opening of the start form.
    Look like the code do not work anymore
    dbsOrdine it's used later on the main form

  6. #6
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    You mentioned moving the database to a different folder. Is that folder a trusted location?

  7. #7
    atai is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    22
    yes, is my computer but in a different folder
    The problem I have also if I keep the program on the same folder but I rename it.
    It seems that the VBA code doesn't work if I rename or move the access file

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Declaring and setting dbsOrdini in this procedure does not make it available in another procedure.

    Is this a split db? Exactly what is the error message?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. autoexec macro error 2001
    By bbxrider in forum Macros
    Replies: 5
    Last Post: 01-28-2019, 12:34 AM
  2. Autoexec Macro details?
    By cboshdave in forum Access
    Replies: 6
    Last Post: 11-20-2012, 01:46 PM
  3. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  4. Using parameter in autoexec macro
    By lchurch in forum Queries
    Replies: 0
    Last Post: 03-04-2009, 06:22 PM
  5. Run-time error 2001
    By RONY in forum Programming
    Replies: 0
    Last Post: 12-23-2008, 06:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums