Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimise all other forms when one is loaded 1

Status
Not open for further replies.

ChrisHaynes

Technical User
Mar 9, 2006
80
GB
How do I do this? I have tried using code in the GotFocus event of the form and tried to reference it to the other forms by using

Code:
docmd.minimise, "Forms!frmHome"

This isn't working though.

Can anyone help??

Thanks,
Chris.
 
Minimize has no arguments. you must first select the object:
[tt]DoCmd.SelectObject acForm, "frmHome"
DoCmd.Minimize[/tt]
 
Thanks, I have tried the code below but it isn't working??

Code:
Private Sub Form_GotFocus()

If CurrentProject.AllForms("frm_Software_Home").IsLoaded Then
DoCmd.SelectObject acForm, "frm_Software_Home"
DoCmd.Minimize

End If


End Sub


Any ideas?

Chris
 
A form can receive the focus only if it has no controls or if all visible controls are disabled. If a form contains any visible, enabled controls, the GotFocus event for the form doesn't occur." - Microsoft

Try On Activate.
 
While your in the subject, is there a way to lock the window so the user has to stayed focus on the form?
 
ItIsHardToProgram
Modal is the word you are looking for, I think.
 
It is best to start your own thread. This is not really relevant to ChrisHaynes, I think, so it is a bit unfair.
 
Hi Remou, thanks for your suggestion. I have it working now. I used the minimise code on the command button because when I did it on load, and then set the focus back to the opened form, it went round in a loop and crashed my computer!

Chris
 
Not On Load, On Activate :)
I am glad it is working for you. If you wish to minimise all open forms, you could loop through the Forms collection and minimise any that are not 'this' one.
 
OK. I will try that. Thanks for all your help. It's greatly appreciated!

Cheers.
Chris.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top