Hide Main DB window - only show form - ACCESS 2010 (2 Viewers)

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:31
Joined
Jan 20, 2009
Messages
12,852
Don't use the switchboard. Create a form to do the same job.

BTW Welcome to the forum.
 

marais

New member
Local time
Today, 05:31
Joined
Sep 30, 2014
Messages
5
Hi Nigel.. new to this forum. I have same issue as gregory..

When my query opens, it has access back ground. I would like to see only the query and able to close the query. Any inputs are appreciated. Thanks in advance.
 

marais

New member
Local time
Today, 05:31
Joined
Sep 30, 2014
Messages
5
Thanks Nigel. The reports now open as they should but access gets open as well in the background (I can see the ribbon, tables, queries, etc).
Is there a way to re-hide everything once the report is open?
Thanks,


Hello Gregory,
Did you find any solution for your issue yet?
I have same issue. not able to find a solution yet..
pl let me know. Thanks
 

marais

New member
Local time
Today, 05:31
Joined
Sep 30, 2014
Messages
5
Hi I have the following code and I see query and access window at the background. Is there a way to show only query , but not the access window at the background..?

DoCmd.OpenQuery stDocName, acViewNormal, acReadOnly
fSetAccessWindow (SW_SHOWNORMAL)

Please help..
 

LittleE

New member
Local time
Today, 02:31
Joined
Aug 7, 2015
Messages
7
bleep-blop - did you ever manage to solve the issue? I'm having the exact same problem...

I can open databases individually with the access window hidden, but when opening the database via a hyperlink from another database the access window comes back on the first form that is loaded...
 

NigelShaw

Registered User.
Local time
Today, 10:31
Joined
Jan 11, 2008
Messages
1,573
Hi

sorry i havent managed to reply before now, I dont use Access any more as i migrated to vb.Net. Anyway, This sample should help you all out. When it opens, the Access window is completely hidden even from the taskbar.

I would strongly recommend looking at the code first to see what happens in the load event. If you close the form while the access window is hidden, you will need to close access via the task manager. It will be restored the next time you open Access.

I am not responsible for any coding errors you may create nor am i responsible if you cannot get to you access window. In other words, You use it at your own risk :)

When the access window is hidden, there should be an icon in the systray. if you right click on the tray, you have a few options. Take a look at the coding for this too.

Any question you have, feel free to message back and i will do what i can.

Hope it helps :)

Nigel

PS. As a side note, you are not supposed to remove the access window from access applications. I found a workaround though which should be inline with the T&C's. I re-created the runtime status bar onto my form exactly as Access shows it. The T&C's read that this must be shown at all times (or something like that)
 

Attachments

  • Hide Window to Systray.zip
    104.5 KB · Views: 655

LittleE

New member
Local time
Today, 02:31
Joined
Aug 7, 2015
Messages
7
Thanks for the reply Nigel. The database you attached works fine on it's own, but again when I link to it via a hyperlink from another database it doesn't work the same way... The access window appears in the background...
 

NigelShaw

Registered User.
Local time
Today, 10:31
Joined
Jan 11, 2008
Messages
1,573
Thanks for the reply Nigel. The database you attached works fine on it's own, but again when I link to it via a hyperlink from another database it doesn't work the same way... The access window appears in the background...

Hi,

couple of things. What is the reason for a hyperlink to open the database instead of a shortcut? also, do you have an autoexec set up in the database to fires when the database opens? you could set this up to call the routine that hides the access window.

Let me know. If you still struggle, send me a pm and i'll send you my email address to post me the database so i can figure it out.

Nige
 

LittleE

New member
Local time
Today, 02:31
Joined
Aug 7, 2015
Messages
7
Hi Nigel,

I have multiple databases. Rather than having to send an updated database to the users every time I make changes I want to be able to update them in the background. So I just give the users a font page with links to the different databases...

I have attached a sample database with just one button that's a hyperlink to the sample database you provided earlier. You will need to change the file path in vba to wherever you have the file saved on your computer.

You'll notice that your sample will open with the access window in the background....

Cheers,
Elisa
 

Attachments

  • TEST.mdb
    480 KB · Views: 233

jdmartin

New member
Local time
Today, 05:31
Joined
Nov 3, 2015
Messages
1
Hi,

it can be done with vba code-

Code:
Option Compare Database 
Option Explicit 
 
Global Const SW_HIDE = 0 
Global Const SW_SHOWNORMAL = 1 
Global Const SW_SHOWMINIMIZED = 2 
Global Const SW_SHOWMAXIMIZED = 3 
 
Private Declare Function apiShowWindow Lib "user32" _ 
Alias "ShowWindow" (ByVal hWnd As Long, _ 
ByVal nCmdShow As Long) As Long 
 
Function fSetAccessWindow(nCmdShow As Long) 
     
    Dim loX As Long 
    Dim loForm As Form 
    On Error Resume Next 
    Set loForm = Screen.ActiveForm 
     
    If Err <> 0 Then 
        loX = apiShowWindow(hWndAccessApp, nCmdShow) 
        Err.Clear 
    End If 
     
    If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then 
        MsgBox "Cannot minimize Access with " _ 
        & (loForm.Caption + " ") _ 
        & "form on screen" 
    ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then 
        MsgBox "Cannot hide Access with " _ 
        & (loForm.Caption + " ") _ 
        & "form on screen" 
    Else 
        loX = apiShowWindow(hWndAccessApp, nCmdShow) 
    End If 
    fSetAccessWindow = (loX <> 0) 
End Function
you call it like this-
Code:
fSetAccessWindow(SW_SHOWMINIMIZED)
you form has to be popup though otherwise, it will disappear with the database window.....


Cheers

Nidge

I realize this is a very old thread, but as I'm still learning Access 2010, can someone tell me where the above code needs to be placed, and where it should be called from?

Thanks so much...

Jim
 

drybone

Registered User.
Local time
Today, 05:31
Joined
Mar 31, 2015
Messages
29
Hey all,
I pasted this code into a module and called it in a form "on open" event:

Code:
 Option Compare Database
 Private Sub Form_Open(Cancel As Integer)
  Me.Visible = True
 fSetAccessWindow (SW_HIDE)
  End Sub

now, whenever I open the form in question it gives me an error:

it is saying that (SW_HIDE) is ambiguous. Can anyone explain to me why this is happening?

Thanks in advance and have a good one.
 

KaananAdams

New member
Local time
Today, 02:31
Joined
Mar 30, 2016
Messages
3
I have used this code and made sure my forms are set to popup. I am still having an issue with the form minimizing with the access window. :banghead:
 

KaananAdams

New member
Local time
Today, 02:31
Joined
Mar 30, 2016
Messages
3
The long portion of the code will be placed in a module. Create a module within your VBA code and paste it in.

The call function will be placed in the load form of your userform. If you click on the form and go to the properties window "OnLoad" is located under the "Other" tab.
 

KaananAdams

New member
Local time
Today, 02:31
Joined
Mar 30, 2016
Messages
3
I realize this is a very old thread, but as I'm still learning Access 2010, can someone tell me where the above code needs to be placed, and where it should be called from?

Thanks so much...

Jim

The long portion of the code will be placed in a module. Create a module within your VBA code and paste it in.

The call function will be placed in the load form of your userform. If you click on the form and go to the properties window "OnLoad" is located under the "Other" tab.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:31
Joined
Feb 28, 2001
Messages
27,194
There is another approach - hide the screen-control buttons and then maximize the form and bring it to the front so that you can see the form filling up the window. (I have turned off the ribbon, so it doesn't try to coexist with the form).

This works even if the Access window would otherwise have been normalized (i.e. not maximized to full-screen).
 

ttaylor57

New member
Local time
Today, 02:31
Joined
Apr 13, 2016
Messages
1
Hi!
Thank you EVERYONE! and in particular Nigel! I'm also experiencing the hyperlink problem. Attached is an image of my popup form to give a better idea of what I mean.

Anyway, I have a popup form... i've placed the call code in the onload event for the form. Everything works as expected. BUT, at the bottom of the form, I have a button "File Preview." When the user clicks here, the form resizes and shows a web browser control (wherein we can see the file that's being called).

The issue comes with the click of the "file preview" button. On click, the parent popup form of the web browser control is suppressed with the application screen. Of course ... adding the call normal of the procedure returns the form, but also the application.

Might anyone have a solution (Nigel? :eek:)
 

Attachments

  • FormSample.jpg
    FormSample.jpg
    97.3 KB · Views: 261

optimuz

New member
Local time
Today, 02:31
Joined
Jun 25, 2016
Messages
3
hi im from Sri Lanka... just got this sorted out on my own...

annnnndddd it works clean...

heres how..

1. Create a macro just go to Create--> macro
2. in the action field type or find using the drop down list "Run Command"
3. in the action arguments form below ( not right after the action field, just look below) in the "Command" field select "appMinimize"
4.then in the action field find a second value "openForm"
5. in the arguments field you can give your desired form to pop up, it's state, any filters,windows state and all.
6. save all & rename the Macro as AutoExec
7. happily close your database and open... BOOM... you got the miracle in simple steps..
8. if anyone ran to a situation where nothing could editable again... please open your database while pressing the SHIFT KEY as a life saver.
9. and i recomend you to first create a good set of navigation amoung your forms so that it will be another application like database.
10. YOU KNOW WHAT... I am a NewBee .... hope you like this

Thanks
 

dreborn22

New member
Local time
Today, 02:31
Joined
Jul 4, 2016
Messages
2
Hi,

it can be done with vba code-

Code:
Option Compare Database 
Option Explicit 
 
Global Const SW_HIDE = 0 
Global Const SW_SHOWNORMAL = 1 
Global Const SW_SHOWMINIMIZED = 2 
Global Const SW_SHOWMAXIMIZED = 3 
 
Private Declare Function apiShowWindow Lib "user32" _ 
Alias "ShowWindow" (ByVal hWnd As Long, _ 
ByVal nCmdShow As Long) As Long 
 
Function fSetAccessWindow(nCmdShow As Long) 
     
    Dim loX As Long 
    Dim loForm As Form 
    On Error Resume Next 
    Set loForm = Screen.ActiveForm 
     
    If Err <> 0 Then 
        loX = apiShowWindow(hWndAccessApp, nCmdShow) 
        Err.Clear 
    End If 
     
    If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then 
        MsgBox "Cannot minimize Access with " _ 
        & (loForm.Caption + " ") _ 
        & "form on screen" 
    ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then 
        MsgBox "Cannot hide Access with " _ 
        & (loForm.Caption + " ") _ 
        & "form on screen" 
    Else 
        loX = apiShowWindow(hWndAccessApp, nCmdShow) 
    End If 
    fSetAccessWindow = (loX <> 0) 
End Function

you call it like this-
Code:
fSetAccessWindow(SW_SHOWMINIMIZED)
you form has to be popup though otherwise, it will disappear with the database window.....


Cheers

Nidge


I put this to my DV Form code builder but i got error. where should I put this code?

Thank you
 

lukemallen4

New member
Local time
Today, 05:31
Joined
Nov 16, 2016
Messages
1
Hello all,

This is exactly what i am looking for, i am not super savvy with vb but i know how to copy and paste, i just don't know where i need to put this code, HELP!!!
 

Users who are viewing this thread

Top Bottom