PDA

View Full Version : minimise access on opening of form



bj1280
10-24-2019, 07:20 PM
Hi all, hopefully last question. I have made a form that opens on the click of the database - all works well except that the Access database in visible in full behind the form. I'm trying to minimise it directly to the taskbar so end users don't really notice it, and then I'd like the application to quit when the user closes the form.
Any thoughts please - I have tried quite a few things so far without success, obviously.
A complete novice at coding - the form was made basically using the wizard - the form is set as popup and modal. I have the application for this database set to not show ribbon bars or nav panes - but still, would rather it be on the tasbar.
I have it working fine from a shortcut on the desktop, but other end users will not be able to have the shortcut - they'll have to open it from a central location.
Thanks in advance for any help.

OBP
10-25-2019, 01:48 AM
Closing the database instead of the form is easy, use
docmd.quit
However I provide a warning message before closing ie

Dim response
response = MsgBox("Are You Sure You Want to Quit Access", vbYesNo + vbExclamation + vbDefaultButton2)
If response = vbNo Then Exit Sub ' User chose No.

DoCmd.Quit



As to hiding Access I have seen a couple of methods, one involves Current Database Settings, but not a popup form and the other involves quite complex VBA code requires a popup form.
But the simplest advice I have seen is this one

https://www.alvechurchdata.co.uk/hints-and-tips/acchide.html

bj1280
10-29-2019, 12:33 AM
1

bj1280
10-29-2019, 12:36 AM
Hey OBP - would you mind having a look at something for me please. As new and green to access as I am, so far I have been successful in getting most things to work on my project. I am however, having one problem in trying to populate a list box on the selection of another list box. I have read numerous and numerous posts, copied and pasted code etc, but nothing is working. So far I have Table 1 which contains fullname, building, position, ext and mobile.
Table2 contains building and fullname. Listbox101 is populated with building names from Table2. I am trying to populate another listbox with the names associated with the building they work in after that building in listbox101 is clicked. All I ever seem to achieve is all the names appearing in the second listbox already populated. Thanks in advance, and if you can't thats ok as well. I'd upload the file but it says its an invalid file - and to be sure you know, I have basically made this using the wizard - no code :-)

OBP
10-29-2019, 02:09 AM
It may be that you are trying to upload an Access Database, they have to be in a Zip file to be acceptable.
The way that I achieve what you are trying to do is by using a Query for the second listbox, (although I use combo boxes), the Query has to include the table 2 field that contains the "Building" value from Table 1, ie the field that relates the 2 tables.
Then in that field's Criteria Row in the query you add

Forms![Formname]![combo1name]

You can select the first combo and then run the query and see what list you get, so you can test the output.

All it requires then is to add the following code to the 1st Combo box's "After Update Event Procedure"

me.[combo2name].requery

If you can't get it to work I will create you a simple database.

bj1280
10-29-2019, 07:30 PM
Legend - all sorted - big thanks