Results 1 to 14 of 14
  1. #1
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91

    VBA to open form when opening Database

    I know this can be set in the current database options but is there a way to set a form to open when opening a database with VBA. I'm trying to prevent people in the office from being able to change it in their settings without disabling the ribbon. TIA

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Use a macro called autoexec and open the form in that.
    However, db should be an accde? Then I think that option might not be available. You would need to check. Plus disable shift bypass.
    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

  3. #3
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91
    Yes, I always distribute the db files as accde and thus far, I don't think anyone in the office knows about shift bypass but I don't like depending on that for db security. We're starting to get more people in the company and I'm trying to compartmentalize the different departments without having to customize every individual db file

  4. #4
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91
    I went with the AutoExec macro method. I actually forgot about that option

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    You can disable shift bypass? I realize if you know what you're doing, you can over-ride it, but I'd never reveal how to do that in a forum. I used to have a label on a form that was red if enabled, black if not, in case I wanted to check if I left it off in an updated db. Enabling it doesn't get a nosy user very far in an accde anyway? I would have thought that accde file would not allow the changing of the opening form, but if it does, why bother having it when you can load it via code - which the user cannot change?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91
    I was shown a method to disable shift bypass in a security seminar I took when I first started learning VBA. I used the code in the project db we built for the class but have never used it in my office db. Being a small company, I haven't really felt the need to get that extreme about security.

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I haven't really felt the need to get that extreme about security.
    Then the horse has not ever left the barn - yet.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91
    Like I say, we're a small company. It's not really malicious intent that I'm worried about, it's people messing around in places they're not supposed to be and clicking things they shouldn't be clicking which has been a problem in the past. My boss is being the biggest violator. A huge part of the time I've spent building our db has been figuring out ways to prevent that

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    I know where you are coming from.
    I also worked in a smal company and luckily for me, mine were only used by managers or just myself.
    Still made accde though, evern when for myself. In fact if I open one now here at home, it comes up with a warning 'this is not the accde'
    That was implemented when I created a DB for lloyds bank, and some people would copy the wrong file. At that time, I was not aware of auto FE updating.
    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

  10. #10
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91
    Auto FE updating? I'd love to know more about that. We are not operating on a local network. Our BE tables are hosted on SharePoint if that matters at all

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Well, I would have thought your pcs would be on a local network?
    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
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    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

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Here is the Bob Larsen one.
    Gicu (Vlad's) as well.

    https://www.access-programmers.co.uk...tility.320072/

    Others just use a batch file that copies the master fe each time the user fe is opened, normally by a shortcut to a batch/cmd file.
    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
    Glenley is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    91
    Thank you very much. I'll check out these links. Yes, we're a small business but half of our organization is spread throughout the US doing sales. The best solution we could find to have cloud server based tables without the costs of SQL Server was SharePoint. We'll eventually outgrow SP but it has worked great so far. As of right now, we're dealing with less than 10k records

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

Similar Threads

  1. Replies: 2
    Last Post: 07-26-2018, 01:32 PM
  2. Replies: 4
    Last Post: 05-31-2018, 12:16 PM
  3. Replies: 4
    Last Post: 09-19-2014, 01:31 AM
  4. Need form to open upon database opening
    By kamigo in forum Access
    Replies: 3
    Last Post: 05-10-2010, 02:17 PM
  5. Replies: 4
    Last Post: 07-22-2009, 02:33 PM

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