Thank you! I thought that was probably the case but wasn't sure. I tend to favor being explicit and just sometimes forget the implied defaults lol
Just as a heads up - What did you call the Module the function is in?
It can't be the same as the function name
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
The trusted location method worked, thank you.
The module has a different name anyways.
It would be nice to understand why I get that error, so I can avoid this error messages in case other users have not set the trusted locations.
My guess is that when the file is opened, the main form is loaded automatically, and in the main form there is a subform in which the data is sorted automatically using the function Format_String. Whenever the database file is opened for the first time in an untrusted location, the form still loads but the function Format_String is disabled, and results in an error.
Probably a workaround cold be preventing the form from opening if the macros are still not enabled by the user. Is it possible? (of course without using VBA, since the code couldn't be run in that case...)
Another option would be to set the subforms sourceobject in the main form load event VBA, that would prevent it from being loaded if the code wasn't running.
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Okay, I solved by making the main form open via VBA code in another AUX_form that is opened at startup (in hidden mode) using the Autoexec macro. If the macro are not enabled, the code can't be run and the form can't be opened automatically.
Probably I could have achieved the same result by setting the Autoexec macro to open the main form directly, but I already had set up the AUX_form for other purposes, so I decided to use it.