• Application Window (Access 2000)

    • This topic has 14 replies, 6 voices, and was last updated 22 years ago.
    Author
    Topic
    #383845

    I would like my database to open to the designated start form, but without the Access application window showing behind it. Is this possible?

    Viewing 1 reply thread
    Author
    Replies
    • #656031

      Yes: select Tools/Startup…

      Select the form you want to be displayed when the database is opened, and uncheck the “Show Database Window” check box.

      You can also set other options in this dialog (for instance whether to show complete menus and toolbars)

      To bypass the startup options (for design purposes), keep the Shift key down while opening the database.

      • #656033

        Thanks, but I’ve already done this part. What I would like is for the Access application window to not display; only my start form. I don’t know if there is a way to do that.

        • #656036

          I’m sorry, I misread your question. I thought you meant the database window.
          No, you can’t hide the Access application window – your form would be hidden too.

          • #656059

            Actually you can hide the Access Window. It involves API calls.

            Have a look at at http://www.mvps.org/access/api/api0019.htm%5B/url%5D

            • #656099

              Bryan,

              I stand corrected. Thanks to you and Drew – I learned something new.

            • #656101

              Me too – I’m impressed. We do something a little different in that we hide all the standard toolbars and menus, change the application title, and maximize the visible form within the application window. I guess it achieves about the same thing in the long run.

    • #656071

      Put this code inside of a module:

      Option Compare Database
      Option Explicit
      Private Declare Function IsWindowVisible Lib “user32” (ByVal hwnd As Long) As Long
      Dim dwReturn As Long
      Const SW_HIDE = 0
      Const SW_SHOWNORMAL = 1
      Const SW_SHOWMINIMIZED = 2
      Const SW_SHOWMAXIMIZED = 3
      Private Declare Function ShowWindow Lib “user32” (ByVal hwnd As Long, _
      ByVal nCmdShow As Long) As Long
      Public Function AccessWindow(Optional Procedure As String) As Boolean
      Select Case Procedure
      Case “Hide”
      dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
      Case “Show”
      dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
      Case “Minimize”
      dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
      Case “Switch”
      If IsWindowVisible(hWndAccessApp) = 1 Then
      dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
      Else
      dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
      End If
      End Select
      AccessWindow = IsWindowVisible(hWndAccessApp)
      End Function

      To use this code, you have 5 options:
      AccessWindow “Hide” ‘This will hide the Access Window
      AccessWindow “Show” ‘This will show the Access Window
      AccessWindow “MInimize” ‘This will minimize the Access Window
      AccessWindow “Switch” This will switch the Access Window from visible to hidden or from hidden to visible.
      Finally, you can check the ‘status’ of the window by just retrieving the value AccessWindow returns (so If AccessWindow Then ‘will fire if the Access window is visible)

      One word of caution. You must have at least one visible form on the desktop when you hide the Access window. However, if you don’t, there is still hope. I am attaching a little VB .exe I wrote, which will unhide all instances of Access that it finds on your machine. (Very handy when developing with an app that hides the Access Window).

      • #656271

        Very good Drew.
        When would you use this? Maybe if you wanted to start the application and do something behind the scenes invisibly?

        Pat cheers

        • #656272

          Actually, the code on The Access Web is actually the first code I ever used. It took me a while to figure how to even use it, but once I did, there was no looking back, I was on the VBA track! evilgrin

          What I personally needed the code for at that time, was the people I was writing a database for were extremely computer illiterate. The more stuff on the screen, the more confused they were. So by hiding the Access Window, I was able to give them just the forms, with nothing else on the desktop.

          It also adds a little more ‘ad hoc’ security, since you are effectively preventing a user from doing anything in Access other then what you have put into the forms you display. If the Shift Bypass option is disabled, it is even more effective.

          The only real quirk with hiding that window, is if you need to preview a report. There is no way to do that when the Access Window is hidden.

          • #656280

            >>So by hiding the Access Window, I was able to give them just the forms, with nothing else on the desktop.<<
            What I found when I did the "hide" was that the Access instance disappeared and left no form on the screen at all. What I did was to open a form that opened another form from a button and the second open form had the "hide" in it's OnOpen event. As I said it hid the entire instance.
            Strange, from what you have described.
            Pat shrug

            • #656287

              In a round about way, you ran into and solved the form issue.

              In Access 97, you forms (that you want the user to see) must have their popup value to true.

              In Access 2000 (and I assume 2002 (but I can’t verify this for 2002)), you must have the Popup AND Modal properties set to true.

            • #656291

              Thanks Drew, I have A97 so all I had to do is what you said, set the PopUp to Yes.
              Pat cheers

            • #656296

              No problem. Glad to help. Remember to download that .exe I posted. When developing it can come in really handy!

            • #656331

              I already had downloaded that exe and it has already come in handy.
              Thanks again.
              Pat smile

    Viewing 1 reply thread
    Reply To: Application Window (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: