Hide Main DB window - only show form - ACCESS 2010 (1 Viewer)

1DMF

Registered User.
Local time
Today, 11:54
Joined
Oct 20, 2011
Messages
14
I seem to be going round in circles trying to hide the main DB background so only the open form is showing.

Can this be done?

I've unticked every single option on Options -> Current Database

I've made ALL my forms popup, i've packaged it into a runtime.

Nothing will make that darn background main db window go away.

Help! :confused:
 

NigelShaw

Registered User.
Local time
Today, 11:54
Joined
Jan 11, 2008
Messages
1,573
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
 

Barrie Yeomans

New member
Local time
Today, 04:54
Joined
May 30, 2013
Messages
4
Nigel,
Great code and exactly what I was looking for. Managed to get a simple user input form to float over the desktop without any Access environment baggage. Proud of myself (and you) until I came to distribute it to non-Access users under the 2010 Runtime, where it failed with "Expression On Open ... search key was not found.."

In short, it runs fine under full Access but not under the Runtime (what else is new).

Any ideas?
 

NigelShaw

Registered User.
Local time
Today, 11:54
Joined
Jan 11, 2008
Messages
1,573
Nigel,
Great code and exactly what I was looking for. Managed to get a simple user input form to float over the desktop without any Access environment baggage. Proud of myself (and you) until I came to distribute it to non-Access users under the 2010 Runtime, where it failed with "Expression On Open ... search key was not found.."

In short, it runs fine under full Access but not under the Runtime (what else is new).

Any ideas?

Hmmmmm that's odd. I have the same code on a runtime and it works great. I could take a look at your DB as it may be some other rogue coding. Search key wouldn't be related I think.

You can PM me and I'll send my email address

Thanks
 

Barrie Yeomans

New member
Local time
Today, 04:54
Joined
May 30, 2013
Messages
4
Oops! Huge slice of humble pie and sincere apologies to Nigel for raising doubts about his code. Slightly less sincere ones to Microsoft for being rude about Runtime.

Truth is I had been forum-surfing to find a solution and had all sorts of stuff in there to suppress the ribbon bar etc. Thought I had sanitized them all but, yes, there was one left and that was the rogue.

In fact Nigel's works fine, including under Runtime, and with his permission I will be using it again (for in-house, not for resale stuff) as I really like the ability to show a simple input Form as a tile on the desktop without the Access Environment overhead.

Thanks again.
Baz.
 

NigelShaw

Registered User.
Local time
Today, 11:54
Joined
Jan 11, 2008
Messages
1,573
Oops! Huge slice of humble pie and sincere apologies to Nigel for raising doubts about his code. Slightly less sincere ones to Microsoft for being rude about Runtime.

Truth is I had been forum-surfing to find a solution and had all sorts of stuff in there to suppress the ribbon bar etc. Thought I had sanitized them all but, yes, there was one left and that was the rogue.

In fact Nigel's works fine, including under Runtime, and with his permission I will be using it again (for in-house, not for resale stuff) as I really like the ability to show a simple input Form as a tile on the desktop without the Access Environment overhead.

Thanks again.
Baz.
Hi Barrie

you dont need my permission as the code is readily available on the internet

FYI... i have also managed to not only hide the application window (where it is suppressed to the taskbar), but completely hide the window from the taskbar too and show it in the systray (bottom right). This is much better for me because i didnt want access at all which is still possible by hiding the application window to the taskbar

my splashbuilder tool shows this and it works really well


thanks
 

Gregory

New member
Local time
Today, 12:54
Joined
Aug 12, 2013
Messages
2
Hello
I tried the code above and it works great - thanks for sharing it!
The only issue that I experience is when I launch a report (via a button on a form), the report is shrunk horizontally and I can't resize it (it's so shrunk that I can't even see what's in the report - see screenshot attached).
Any idea why and how to fix this? I tried to change the report to "pop-up" and "modal" but with no success.
Many thanks
 

Attachments

  • formissue.JPG
    formissue.JPG
    16.1 KB · Views: 3,274
  • formissue2.JPG
    formissue2.JPG
    74.6 KB · Views: 2,965

NigelShaw

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

without checking i would say its the code. because the code wants to suppress everything that would include the report window unless you explicitly ask it not to

you could try putting this code in the OnOpen event of the report form-

Code:
 fSetAccessWindow(SW_SHOWNORMAL)

Let me know how you get on


Thanks

Nigel
 

Gregory

New member
Local time
Today, 12:54
Joined
Aug 12, 2013
Messages
2
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,
 

bleep-blop

Registered User.
Local time
Today, 11:54
Joined
Sep 30, 2013
Messages
24
Hi,

I have used this code, and it works nicely.

I have the
Code:
fSetAccessWindow (SW_SHOWMINIMIZED)

on the ONload for every form.

I have only one small issue,

When the user uses another program or opens up mydocuments etc then switches back to access. The Grey background behind my popup forms reappears. It disappears if the user navigatives to a new form (as it runs
Code:
fSetAccessWindow (SW_SHOWMINIMIZED)
)

How can i get Access to run
Code:
fSetAccessWindow (SW_SHOWMINIMIZED)
when the user goes back on to it from another program?

Any ideas?
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 22:54
Joined
Jan 20, 2009
Messages
12,849
BTW. Hiding the database window is a breach of the terms and conditions relevant to the use of Access Runtime.
 

NigelShaw

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

Just to clarify the 'Breach'.......

I read in MS documentation that it is in breach not to display the runtime text "powered by Microsoft access runtime" and the associated logo.

In one of my apps, I needed to hide the window so read in depth what I could get away with. I placed the text and logo onto my form this still displaying what I should be displaying.

Not only do I hide my window, it's completely hidden from everyone and I placed a systray icon with options :)

Thanks

Nigel
 

prabhus

Registered User.
Local time
Today, 04:54
Joined
Mar 14, 2012
Messages
67
Hi Nigel,

When i use this fSetAccessWindow(SW_SHOWMINIMIZED) in my Home form, it hide this form also along with the access window. how to fix this.
 

kt1978

Registered User.
Local time
Today, 11:54
Joined
Jan 15, 2011
Messages
43
Hi

I'm using the code to hide the access window which is all great for the user point of view.

However, when I restore it with this...
Code:
fSetAccessWindow(SW_SHOWMAXIMIZED)

I don't get any of the toolbars/ribbon back until I close and reopen access.

Its not a major one, just an inconvenience.

Can this be done?
 

gclarkox

New member
Local time
Today, 07:54
Joined
Mar 21, 2014
Messages
1
Nigel: Trying to use your post to hide the MS Access window. Getting an error. Would you look at my DB and see what you can find? Would be greatly appreciated. Running Windows 8.1. Thanks for your help.
 

RFigaro

Registered User.
Local time
Today, 04:54
Joined
Aug 5, 2012
Messages
18
Thank you for posting this code it is exactly what I was looking for. However I am still struggling with implementing it properly. Everything looks great on start-up the main access window is hidden and my form is popped up but when you click on the icon in the task bar the main access window with all the menus pops back up. I am using 2010 and have the form set to pop up and put fSetAccessWindow (SW_SHOWMINIMIZED) in the on load event and set that form to display when access is opened. I am not sure what whether I am missing some code, a whole step in the process or a setting in setup etc…
Any help would be greatly appreciated.
Thank you,
 

erick24hau

New member
Local time
Today, 04:54
Joined
Jun 6, 2014
Messages
1
Hi. I am getting the same problem with RFigaro. The worst thing is that the main access window reappears and blocks of other applications on the screen. I tried calling the fSetAccessWindow on 'On Current' event but it results on an error: "Cannot minimize Access with Switchboard form on screen". Btw, I am using a standard ms-access switchboard form. At the moment, I just instructed our users not to click on the icon at the task bar, instead use alt-tab to navigate between windows. Any ideas?
 

Users who are viewing this thread

Top Bottom