closing or minimizing access

G

Guest

I have two similar questions. I have a database that uses minimized forms to
pull data from. Meaning, a user makes a selection from a combo box on a form
and once they click "OK" the form is minimized and the appropriate data is
accessed in another form based on the selection in the minimized form. Is
there a way that I can prevent the minimized form from being maximized once
there is data in the combo box? Also, I have a hidden form that opens when
the database is opened. I would like to prevent the user from closing the
database unless they use the close database command on my switchboard. I
wold like to write a procedure to cancel the close of the database if a user
uses the red "X" button in access to close the database and I believe some
code can be written in the hidden forms unload or on close event. Can anyone
give me some help here?

You all have helped me trememdously and I have learned so much via this
discussion group and I would like to thank all who help and all who write
questions that have helped me as well. I have even been able to answer
questions myself at some points so again, thank you all!!


Rob
 
G

Guest

As to your first question, you could use the Activate event of th form to
keep it minimized if the combo box has a value:

If Not IsNull(Me.MyCombo) Then
Docmd.Minimize
End If

But, you will not be able to open it again unless you make it null from some
other code:
Forms!MyForm!MyCombo = Null

Second question

Use the Unload event of the hidden form to do whatever you need to do before
the application closes. If you want to prevent the form closing, cancel the
event

Cancel = True
 
G

Guest

I tried the code in the "On Activate" event as well as the GotFocus event and
it does not stop the form from maximizing. Even if I click on the form
itself once I minimized Access and then open it again, it doesn't seem to get
the focus nor does it become "activated".

Also, I don't want to prevent the database from closing entirely, I just
want it not to close if the red "X" in the corner of Access itself it clicked
to close. Sorry if this sounds confusing and I really appreciate the help!!
 
G

Guest

--
Dave Hargis, Microsoft Access MVP


Rob said:
I tried the code in the "On Activate" event as well as the GotFocus event and
it does not stop the form from maximizing. Even if I click on the form
itself once I minimized Access and then open it again, it doesn't seem to get
the focus nor does it become "activated".

What was the value in the combo box?
Also, I don't want to prevent the database from closing entirely, I just
want it not to close if the red "X" in the corner of Access itself it clicked
to close. Sorry if this sounds confusing and I really appreciate the help!!

Why? It doesn't really matter where it is closed from.
 
G

Guest

The only way I would like the database to be closed from is from the Main
Menu. The only way to get to this Main Menu is by making sure that the forms
are complete. The foms have a checklist that must be filled out properly
before they can close. They can pause on the checklist and the data is
captured in a different table. But if they close the database instead of
pausing the data is captured in the wrong table and the reporting will be off.

The data in the combo box in this case is the Document Type name "ACMM" or
"CD-ROM APP", 32 different types in all.
 
G

Guest

There are other ways to close the database. Close Access. Shut the computer
down, so you will never be totally safe, however, my suggestion stands.
Using the Unload event as I suggested, you can execute the code that runs to
verify the data before it closes and if data is missing, cancel the undo.
 
G

Guest

I see your point and thanks. I will have a popup box giving them the option
to close for sure or to not and to go back and complete their work. What
about the combo box and the form being minimized. Any suggestions? As i
stated, it doesn't seem to get the focus or Activate when restoring from a
totally minimized state. i.e. Access itself.
 
G

Guest

Are you saying when the applicaton is minimized, or the form is minimized?
I do not know of any application level event that fires when the application
is minimized or maximized.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top