Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91

    use of autoexec in access

    Hello chaps
    I am trying to "decipher" northwind because i want to copy some of the code into my own programs
    where can i find how to use autoexec in programming with access?
    I see Northwind has it as a macro - but I dont know how to get there
    I probably need to know about macros - where can i find some tutorials on the subject
    Many thanks
    Fred

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,444
    macros are not the way to go unless you are only ever going to be a very light user of access. Reason is they have limited functionality compared with VBA and are difficult to debug when you have a problem.

    To open a macro such as the autoexec macro. scroll down the navigation window to the macro's section, right click on a macro and select design view.

    To use an autoexec macro, just name it as autoexec when you save the macro - it will fire up when you open the application after any form that has been specified in file>options>current database and subject to the file being in a trusted location

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,525
    Like Ajax I don't use macros. You'd be much better off learning VBA. The only time I ever use an autoexec macro is for automated apps where I just want to fire off a VBA function when the app opens.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91
    yes thanks the answers are relevant and interesting- but-
    i dont want to use macros for programming . I am just trying to decypher northwind.accdb and it starts with an autoexec.
    i am trying to figure what kicks to autoexec into action
    I have found the code in the navigation window - and can understand what it is saying ( although both call seem to be the same so i just want to
    see what starts it off
    thanks and regards

  5. #5
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91
    yes thanks the answers are relevant and interesting- but-
    i dont want to use macros for programming . I am just trying to decypher northwind.accdb and it starts with an autoexec.
    i am trying to figure what kicks to autoexec into action
    I have found the code in the navigation window - and can understand what it is saying ( although both call seem to be the same so i just want to
    see what starts it off
    thanks and regards

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,444
    i am trying to figure what kicks to autoexec into action
    when access opens it looks for a macro called 'autoexec'. If it find it it executes it, if it doesn't then nothing happens.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,951
    The only macro I have made use of is AutoKeys to disable Ctrl+p because I couldn't find a way to do in VBA.
    Last edited by June7; 06-11-2022 at 08:58 AM.
    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.

  8. #8
    Join Date
    Apr 2017
    Posts
    1,686
    Quote Originally Posted by ntambomvu View Post
    I am just trying to decypher northwind.accdb and it starts with an autoexec.
    i am trying to figure what kicks to autoexec into action
    When the database is opened, a form is set to be opened automatically. Activate design mode, open this form in design mode, activate form's properties and select Event page there. There must be some event (like OnOpen), which runs the macro. You can activate the event and view or design it there.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,951
    No, there is no code required behind form in order for AutoExec macro to execute. Ajax has it right - Access looks for the AutoExec macro and runs if found. A db with no forms will run AutoExec macro.
    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.

  10. #10
    Join Date
    Apr 2017
    Posts
    1,686
    OK! Using Access for so many years, I hadn't a clue about this feature! But honestly, I didn't miss anything (especially as I never use macros)!

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,980
    I think it is a carry over from the old DOS days?
    If there was a batch file called autoexec in the root folder, then that executed when the PC started up.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91

    autoexec thing

    Quote Originally Posted by Welshgasman View Post
    I think it is a carry over from the old DOS days?
    If there was a batch file called autoexec in the root folder, then that executed when the PC started up.
    thank you very much for this help - everything is a bit clearer now. so that creates another question -
    i want to see what the code is doing so am i right in saying that i can find this out by using n"debug"
    now please - if you have time - instruct me on how and where to insert the debug command
    many thanks
    ( i am an old dos programmer - so you are quite right about that - but i am trying to get my thoughts around VBA )
    so thanks very much
    fred

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,980
    Just open the macro in design mode.
    For debugging, see the link in my signature.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,951
    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.

  15. #15
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,418
    Pictures help. Here's how to locate and view that autoexec macro's function:

    Click image for larger version. 

Name:	Image1.png 
Views:	12 
Size:	33.5 KB 
ID:	48024

    Next

    Click image for larger version. 

Name:	image2.png 
Views:	11 
Size:	43.0 KB 
ID:	48025

    And Finally

    Click image for larger version. 

Name:	image3.png 
Views:	12 
Size:	98.5 KB 
ID:	48026

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access AutoExec Macro Cannot Find Function
    By JuanTooTree in forum Access
    Replies: 10
    Last Post: 06-08-2023, 10:10 AM
  2. Replies: 3
    Last Post: 01-09-2017, 06:20 PM
  3. Access Crashes on rerun of autoexec/login form
    By chris.williams in forum Programming
    Replies: 1
    Last Post: 01-07-2013, 01:16 PM
  4. Replies: 7
    Last Post: 06-14-2012, 01:54 PM
  5. Replies: 2
    Last Post: 06-20-2011, 09:20 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