Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2022
    Posts
    2

    After closing database, forms command button will not trigger VBA

    I have only written three (3) Access Apps in the past 20 years. The last one about 10 to 15 years ago. I am really a beginner and been away along time. I am using Windows 10 with Office 365 Access. This is my first time for these versions. I created a blank database with a table, log-in form, and VBA. The command button on the form triggers the VBA and the code executes correctly when first created. I save everything; however, when I close the database and re-open it, the command button will not trigger the VBA. If I create another form with a command button and VBA, that command button will not trigger the VBA either. The "On-Click" property in both cases points to the appropriate VBA. Has anyone seen this type of scenario before ? Any idea what I am missing ? If you need to see the database, let me know and I will attach it. Not on the machine with the database right now.

    Thanks,


    George

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What is db Options Trust Center settings?
    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
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    When you reopen the database, you may see a yellow bar with a button marked Enable Content. Unless that is clicked, your code will NOT run.
    Better still, go to File...Options...Trust Center ...Ttusted Locations and make the file's location trusted
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    Join Date
    Mar 2022
    Posts
    2
    Thanks so much for the replies. I was not receiving the "Warning" message and thought I had checked the Security settings. I went in and rechecked and realized the authorized directory was the wrong one. Not sure where it came from. Problem solved. Thanks again.

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Hi George. Glad that fixed it.
    I was going to post a screenshot of the yellow message bar and enable content button but its no longer visible for me either even though vba code is blocked
    I'm using Office 365 version 2203 & am wondering whether there is a bug as I can't get the message bar back.
    Which version of Office/Access are you using?
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. same command button on different forms
    By Khalil Handal in forum Modules
    Replies: 12
    Last Post: 03-07-2022, 03:03 AM
  2. Replies: 2
    Last Post: 11-23-2021, 08:55 AM
  3. Replies: 3
    Last Post: 03-13-2020, 01:29 AM
  4. Add Command Button to Multiple Forms
    By jameslefebv in forum Forms
    Replies: 4
    Last Post: 07-14-2014, 07:07 PM
  5. Closing a Form with a Command Button
    By JoeM in forum Forms
    Replies: 5
    Last Post: 06-21-2012, 11:28 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