Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35
  1. #31
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Quote Originally Posted by isladogs View Post
    @kd2017
    I've just skimmed this thread including post #26


    For info, writing Public Function is functionally equivalent to writing Function. All functions in a standard/class module are public unless specifically marked as Private
    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

  2. #32
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    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 ↓↓

  3. #33
    Trial4life is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2022
    Posts
    33
    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...)

  4. #34
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    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 ↓↓

  5. #35
    Trial4life is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2022
    Posts
    33
    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.

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Having trouble getting a query to sort properly
    By S2000magician in forum Queries
    Replies: 6
    Last Post: 07-17-2019, 02:05 PM
  2. Replies: 2
    Last Post: 02-10-2015, 02:12 PM
  3. Replies: 9
    Last Post: 11-14-2014, 06:11 PM
  4. Replies: 10
    Last Post: 05-09-2014, 10:54 AM
  5. Replies: 4
    Last Post: 08-14-2012, 10:33 AM

Tags for this Thread

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