How to hide the Main Acces UI (1 Viewer)

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
@Isaac
I rechecked that approach yesterday before I replied.

Using the approach in the UA link you gave, the form occupies the entire screen apart from the title bar & taskbar.
It is using tabbed document display (with tabs hidden) with popup=No
This means the forms are always full screen .. so (unlike my example), it cannot 'float on the desktop'.
Nothing wrong with that approach - its just different to what I demonstrate

Have you looked at my example?
 

Isaac

Lifelong Learner
Local time
Yesterday, 18:48
Joined
Mar 14, 2017
Messages
8,738
Yes, I saw your screenshot. I haven't tried your code, I've just been focused on the question of what the UA link instructions achieve.
Here is a screenshot of one of my databases after following those instructions. (and if it doesn't open like this you can just Restore the screen-in between minimize/maximize

example.jpg
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
Yes you can restore the window but you still have the application title bar at the very least

1602172675079.png


Also ... I haven't tried but ...what happens if you open a report with that setup?
EDIT: the report appears and fills the space available in report view.
In print preview mode, the ribbon remains hidden
 
Last edited:

Isaac

Lifelong Learner
Local time
Yesterday, 18:48
Joined
Mar 14, 2017
Messages
8,738
Yes you can restore the window but you still have the application title bar at the very least

View attachment 85651

Also ... I haven't tried but ...what happens if you open a report with that setup?
For me when I restore it, all I still have is the form? As long as the form has a caption, as in my last screenshot.
Reports I haven't tried...But the last time I tried the sw_set window type code, generally reports messed it up.
If your code avoids that - then I would find that especially valuable & impressive.
I avoid Access report objects as much as I can and try to put them in pdfs and excel. So not real experienced in them, except creating them for silent output.
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
I've managed to clear the title bar but am unable to remove it completely.
However, I agree the code is simpler than mine & the appearance is much cleaner than I thought on first test
This is a blank form with a coloured background
1602178176912.png


Managing reports is tricky. In order to do so I do temporarily restore the title bar in report view or dialog mode and in print preview I show the preview ribbon as well. I then remove both when the report is closed. Whilst not a perfect solution, I don't think there is a better way.

Do try it and let me know what you think

Whilst this thread was progressing yesterday I was simultaneously dealing with a similar thread at UA where the OP wanted to use a split form with my approach. I did a workround which satisfied me...but as I never use them myself it wasn't a priority for me.
In the end, The OP found a solution himself and has explained it in detail. Very impressive!
If interested, see https://utteraccess.com/topics/2059521/posts/2764621
 

Isaac

Lifelong Learner
Local time
Yesterday, 18:48
Joined
Mar 14, 2017
Messages
8,738
Do try it and let me know what you think
It's been about 6 months since I was able to utilize Access in any real siginificant way, and that was just to prototype something for my boss.....In the hopes that we find a way for overseas users to connect to our network. It might be a few more months until we do, but when we do, I'll definitely be coming back to places like AWF to review a number of topics. One will be this one (I will try your code for sure in this case), and another will be your in depth analysis and discussions of Security information--especially as, likely I will need to use an Access BE and still won't have SQL Server back yet. It's been 6 months since I've touched it and I am not happy about that! Ha. It will happen here eventually.
 

nonakag

Member
Local time
Yesterday, 15:48
Joined
Apr 30, 2013
Messages
54
All I can say is that when I follow the instructions in the link I posted precisely, it definitely hides the entire Access app - whether the instructions specifically list that out or not. It leaves nothing but a floating form. And, it retains the taskbar icon (of choice).
I've downloaded v3.46. If I just wanted to copy the functionality to have a floating form, what would be the essential items I would need to copy to my DB. Once I've done that, I can work through replacing the objects on the form with the objects on my form. Thank you.
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
@nonakag
As a minimum, you need to copy the module modDatabaseWindow to your app.
I suggest you also copy the modules modRibbon & modNavPaneTaskbar in case you want that functionality.

Using this approach, all forms MUST be popups so they appear independently of the Access application interface which is being hidden

The simplest code to use in the Form_Load event of each form is:
Code:
Private Sub Form_Load()
  SetAccessWindow (SW_SHOWMINIMIZED)
End Sub

I would always recommend adding error handling so this is better:
Code:
Private Sub Form_Load()

On Error GoTo Err_Handler

    SetAccessWindow (SW_SHOWMINIMIZED)

Exit_Handler:
    Exit Sub

Err_Handler:
    MsgBox "Error " & Err.Number & " in Form_Load procedure : " & Err.description
    Resume Exit_Handler
End Sub

There is one issue with the code line SetAccessWindow (SW_SHOWMINIMIZED).
If a user clicks the taskbar icon, the Access application window is restored.
To prevent that, I now use a more complex version of the code:

Code:
Private Sub Form_Load()

On Error GoTo Err_Handler

    SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
    ShowWindow Application.hWndAccessApp, SW_HIDE
    ShowWindow Me.hWnd, SW_SHOW
   
Exit_Handler:
    Exit Sub

Err_Handler:
    MsgBox "Error " & Err.Number & " in Form_Load procedure : " & Err.description
    Resume Exit_Handler
End Sub

In case it helps, attached is another simpler app TestModal which works in the same way.
Both this a couple of other examples are also available from the same page on my website: http://www.mendipdatasystems.co.uk/control-application-interface/4594365418

Hope that helps you move forward
 

Attachments

  • TestModal.zip
    43.5 KB · Views: 128
Last edited:

nonakag

Member
Local time
Yesterday, 15:48
Joined
Apr 30, 2013
Messages
54
@nonakag
As a minimum, you need to copy the module modDatabaseWindow to your app.
I suggest you also copy the modules modRibbon & modNavPaneTaskbar in case you want that functionality.

Using this approach, all forms MUST be popups so they appear independently of the Access application interface which is being hidden

The simplest code to use in the Form_Load event of each form is:
Code:
Private Sub Form_Load()
  SetAccessWindow (SW_SHOWMINIMIZED)
End Sub

I would always recommend adding error handling so this is better:
Code:
Private Sub Form_Load()

On Error GoTo Err_Handler

    SetAccessWindow (SW_SHOWMINIMIZED)

Exit_Handler:
    Exit Sub

Err_Handler:
    MsgBox "Error " & Err.Number & " in Form_Load procedure : " & Err.description
    Resume Exit_Handler
End Sub

There is one issue with the code line SetAccessWindow (SW_SHOWMINIMIZED).
If a user clicks the taskbar icon, the Access application window is restored.
To prevent that, I now use a more complex version of the code:

Code:
Private Sub Form_Load()

On Error GoTo Err_Handler

    SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
    ShowWindow Application.hWndAccessApp, SW_HIDE
    ShowWindow Me.hWnd, SW_SHOW
  
Exit_Handler:
    Exit Sub

Err_Handler:
    MsgBox "Error " & Err.Number & " in Form_Load procedure : " & Err.description
    Resume Exit_Handler
End Sub

In case it helps, attached is another simpler app TestModal which works in the same way.
Both this a couple of other examples are also available from the same page on my website: http://www.mendipdatasystems.co.uk/control-application-interface/4594365418

Hope that helps you move forward
@isladogs, super thanks! I will definitely give this a shot.
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
Let me know how you get on....

Another user has recently pointed out an issue if using the built-in split forms.
I don't recommend using them anyway, but if you intend to do so, let me know and I'll post the slight modification needed to the above code.

Finally, I've not tested this code on the Access navigation forms as I never use them
 

nonakag

Member
Local time
Yesterday, 15:48
Joined
Apr 30, 2013
Messages
54
Let me know how you get on....

Another user has recently pointed out an issue if using the built-in split forms.
I don't recommend using them anyway, but if you intend to do so, let me know and I'll post the slight modification needed to the above code.

Finally, I've not tested this code on the Access navigation forms as I never use them
I was able to put the modules into my application and the code into my main Switchboard form onload event, and catch and solve compile errors until there were no issues. My applications runs over a VPN. Prior to using your application the form would take about 3-4 minutes to load. For some reason it now takes 10-minutes. Also, three of my popup forms will pop up with app window in the background without the code in onload. Two other popup forms seem like they are loading but are not visible. I'll need to experiment by putting the code in each popup onload code. I'll keep updating.
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
I've never had a reason to test my code over a VPN but I can't see how it would cause such a dramatic slowdown
The fact that your form originally took 3-4 minutes to load suggests that you need to review what causes it to takes so long...even over a VPN.
You should be aiming at no more than a few seconds despite any delays inherent in the use of VPNs.
No user should have to wait several minutes for a form to open

Personally, I would concentrate on dealing with that issue rather than adding new levels of complexity by hiding the entire application interface. At least for now, I suggest seeing what happens if you just hide the navigation pane & ribbon. If that allows forms to open in a reasonable time interval, you can then review the rest of the code.

When you do so, remember there are two variations of the code that can be used in Form_Load.
Go back to post #48 for details on each of these
Does the simplified code work any faster. Do its 'limitations' matter?

I'm unable to advise on the specific issues you describe of certain popup forms not appearing.
Good luck ...but I would seriously deal with other issues first and come back to this later
 

Avoraightu

New member
Local time
Yesterday, 19:48
Joined
Mar 5, 2020
Messages
28
Hey Colin, nice work I started using 3.47 today it looks like it will work fine for my application. I just need to tweak my forms as I will be hiding the main application window and using my main form as a switchboard. Barry
 

Avoraightu

New member
Local time
Yesterday, 19:48
Joined
Mar 5, 2020
Messages
28
I did run in to one small snag, I had to add Docmd.Quit to my "On Close" of the main form otherwise the application continues to run in the background. I'm not sure if there is a better way to accomplish this but it seems to work.
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
I did run in to one small snag, I had to add Docmd.Quit to my "On Close" of the main form otherwise the application continues to run in the background. I'm not sure if there is a better way to accomplish this but it seems to work.
My main form or your own?
 

Avoraightu

New member
Local time
Yesterday, 19:48
Joined
Mar 5, 2020
Messages
28
Ya sorry I meant on my form, I didn't put a button on like you did I am just using the default close button on the form.
 

tmyers

Well-known member
Local time
Yesterday, 21:48
Joined
Sep 8, 2020
Messages
1,090
Isla, I have been tinkering off and on with this example.
I want to use your example since it seems to be a happier path vs changing the file to a run time file which security settings absolutely hate.

When trying to do the mouse down to move the form around, I got a "Sub or Function not defined" error on ReleaseCapture. I assume it is in a module and I overlooked it?

Edit:
Correction, I am in fact blind. Found it.
 

isladogs

MVP / VIP
Local time
Today, 01:48
Joined
Jan 14, 2017
Messages
18,186
For anyone else reading this thread, its an API in modMoveForm
 

Users who are viewing this thread

Top Bottom