Results 1 to 4 of 4
  1. #1
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65

    Close the Switchboard when opening a form

    I have never used a switchboard and have no clue how they work. I've been asked to do some modifications to an existing database. I've done just about everything needed. There are some instances when some windows open and you can still see some or all of the switchboard, which I think is sloppy. I want to close the SB when opening a form and then after all the steps of the programing task are completed I will reopen the SB.

    But 1st I have to close it.

    It seems like a simple task but...
    When a form opens from the SB I've tried the following:
    DoCmd.CloseForm "Switchboard"
    DoCmd.Close.Form "Switchboard"

    I have this code for closing a form or finishing printing a report:
    Private Sub Whateveritis_Click()
    DoCmd.Close
    DoCmd.OpenForm "Switchboard"
    End Sub

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    The correct syntax is DoCmd.Close acForm, "Switchboard"

  3. #3
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65
    Thank you John_G! I'm so use to DoCmd.Close I totally for got about "acForm" and did not notice the dropdown all the times I tried before. When I went back to make the proper entry there was the dropdown with "acForm" listed.

  4. #4
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,369
    Maybe you should just hide it? A switchboard is usually used like a background window that's full size. If another form opens on top of it but does not cover the switchboard entirely because the second form is smaller, it shouldn't bother anyone anymore than having parts of the Access window visible as you create. Every time you open this, code will run, which may not be problematic or slow for your application. Where you will probably run into an issue is when your code execution takes an unexpected path and you try to close a form that is already closed, or vice-versa, or you just forgot what state it was in when you invoke the command. You will get an error saying Access cannot find your form if it is already closed, but should not if you hide/unhide-maximize.

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

Similar Threads

  1. Close a form & return to Switchboard
    By ScottXe in forum Forms
    Replies: 14
    Last Post: 08-24-2014, 02:46 AM
  2. Replies: 4
    Last Post: 11-06-2012, 08:36 AM
  3. Opening a PDF from a Switchboard
    By Huddle in forum Access
    Replies: 2
    Last Post: 05-17-2012, 08:08 AM
  4. Use Switchboard to close db AND Access
    By HeadGasket in forum Forms
    Replies: 1
    Last Post: 02-01-2012, 07:08 PM
  5. Close Form A After Opening Form B
    By M4ttyC88 in forum Programming
    Replies: 6
    Last Post: 01-18-2012, 02:06 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