Facing issue while running VBA code on MS Access file open (1 Viewer)

SachAccess

Active member
Local time
Tomorrow, 03:39
Joined
Nov 22, 2021
Messages
389
Hi,

I have a VBA Sub. Am calling this VBA Sub from a AutoExec Macro.
However, when I open MS Access file, it gives me an error.
When I click on 'Enable Content' then VBA code runs without any issue but how can I remove the 'Error pop-up' which am getting as soon as I open the file.

AutoExec also opens a form on MS Access file open event. For that I do not face any issue.
Enable macro in Trust center is blocked for us by the company.
Is this issue related to not enabling all the macros. Am not sure if this is the cause.
But when click 'Enable Content' VBA code runs automatically.

Please see attached screenshots for your reference.
Can anyone please help me in this.
 

Attachments

  • 1.png
    1.png
    45.3 KB · Views: 100
  • 2.png
    2.png
    39.1 KB · Views: 94
  • 3.png
    3.png
    128.3 KB · Views: 94
  • 4.png
    4.png
    48.9 KB · Views: 99

theDBguy

I’m here to help
Staff member
Local time
Today, 15:09
Joined
Oct 29, 2018
Messages
21,474
You can add an If action to your macro to check if the file is trusted and branch accordingly.
 

SachAccess

Active member
Local time
Tomorrow, 03:39
Joined
Nov 22, 2021
Messages
389
Hi @theDBguy thanks for the help. Have a nice day ahead. :)
Will seek help if get stuck.
 

Users who are viewing this thread

Top Bottom