Results 1 to 5 of 5
  1. #1
    romeo_echo is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    3

    Programmatically change default switchboard at startup?

    Hi there, I'm a first-time poster after finding many helpful answers on this forum...

    I'm looking for a way to programmatically change the Default Switchboard via vb code.

    My idea is, I want an autoexec macro to do a quick lookup to see which switchboard a user should get, then set that switchboard as default, then open that switchboard form.



    Right now what I do is I have a separate copy of my front-end database for each different switchboard, which I think is kind of sloppy and can cause confusion. I'd much rather have just one front end that selected the correct switchboard at startup time.

    Is this possible?

    Thanks,

    Romeo

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    do you have your own security built into your database? i.e. they log in with a user name/pw? or are you looking to use their network username and determine which form they are supposed to get?

    In either case you're going to have to build a table that has all the possible user names and which form they are allowed to see at startup and open that specific form

  3. #3
    romeo_echo is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    3
    Yes, that part's easy, I'm using the fOSUserName() function to find out who I'm dealing with (i.e. network login name), then I can lookup that up in a table to find which switchboard they should get. I just need to change the default switchboard programmatically or else the switchboards don't work properly.

    I know I could probably design my own menu forms and subforms and then use those, but the switchboards are kind of dead stupid easy and convenient. I just don't think they were designed with multiple, initial switchboards in mind. If I can change the default switchboard programmatically it would solve that problem.

    Thanks

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    create a form called 'startupdecider' or something like that, make it the default opening form of your database.

    I the ON OPEN event of that form run through your decision making process, open the appropriate form, close the 'startupdecider' form. To my knowledge you can't run code on startup before the database starts but you can trick it by doing it this way.

  5. #5
    romeo_echo is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    3
    That's a pretty good method...

    I've actually got it already working: the autoexec macro calls a function which looks up the username and returns the startup form name for that user, and then it opens that form.

    The main issue is that you need "normal forms", you can't use actual Switchboards. I was hoping to keep using the switchboards that I had and just programmatically change the default Switchboard.

    Actually now that I think about it, I'm sure you could programmatically change the default switchboard by just getting into the "Switchboard Items" table and moving the "Default" tag under the "Argument" column. But it would probably be easier to just get away from Switchboards all together...

    Thanks anyway!

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

Similar Threads

  1. Replies: 7
    Last Post: 03-04-2011, 12:46 PM
  2. How to Programmatically Press a Key
    By Osman in forum Access
    Replies: 5
    Last Post: 11-28-2010, 11:07 AM
  3. Using a Labels Caption Programmatically
    By ksmith in forum Programming
    Replies: 2
    Last Post: 10-12-2010, 01:10 PM
  4. Switchboard at startup
    By jamie c in forum Access
    Replies: 10
    Last Post: 03-04-2010, 12:16 PM
  5. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 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