Results 1 to 3 of 3
  1. #1
    aquaraider is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2009
    Posts
    14

    Question How can I hide/unhide DB window with a single button?

    Hello,

    I'm trying to hide/unhide database window, I've got some idea from the web.

    ====================
    Private Sub cmdHide_Click()
    DoCmd.SelectObject acTable, , True
    DoCmd.RunCommand acCmdWindowHide


    End Sub
    ====================
    Private Sub cmdShow_Click()
    DoCmd.SelectObject acTable, , True
    End Sub
    ====================

    It works but it needs two buttons, one for hide and one for unhide.

    I guess there must be some way to combine them into one button with if statement or something like that.

    But how do I know if DB window has been hidden or not? So that I can put it into if statement as condition? Or are there any other ways to do that?

    Thanks very much.
    Last edited by aquaraider; 10-09-2009 at 06:55 AM.

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    If you create a public variable and save it in a standard module

    Code:
    Public bState As Boolean
    Then on your startup form pass a value to the variable

    Code:
    bState = Ture
    Then when you click on your hide/show button use an if statment to query the boolean state

    Code:
     
    If bState = True Then
       bState = False 'Toggle status
       Hide Database
    Else
       bState = True
       Show Database
    End If
    David

  3. #3
    aquaraider is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2009
    Posts
    14
    Thank you very much! I've made it to complicated and even forgot this simple solution, I'd better go to have a nice sleep :-)

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

Similar Threads

  1. Replies: 6
    Last Post: 06-03-2009, 02:01 PM
  2. Hide/UnHide forms
    By access in forum Forms
    Replies: 3
    Last Post: 06-03-2009, 07:48 AM
  3. Access Window On top
    By Jas_The_Ace in forum Programming
    Replies: 0
    Last Post: 02-28-2009, 04:28 PM
  4. Unhide Hidden Query
    By Valeda in forum Queries
    Replies: 2
    Last Post: 05-12-2006, 05:58 AM
  5. Hide the Database window
    By wasim_sono in forum Access
    Replies: 5
    Last Post: 02-02-2006, 06:41 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