How to minimize the db window

J

James Ivey

The db window is up, and my form is minimized.

When I click on the Restore Up button, I would like the db window to
minimize.

Possible to do?

James
 
W

Wayne-I-M

Hi James

It may be a better idea to simply add a Docmd.Maximise to the form
OnActivate or some other event
 
J

James Ivey

Hi Wayne,

Thanks for replying.

Believe me, I've tried all the events in every way I can think of, and I
still can't seem to get it to work.

What seems nuts to me is that there is no OnRestore event.

What I want to do is this:

Db window is open
Form window is minimized
When I restore the form window, I want the db window to minimize (rather
than both be open at the same time)

I'm hoping someone will give it a try and see what I'm missing.

James
 
J

James Ivey

Here's what I have for the OnActivate event:

Private Sub Form_Activate()
DoCmd.SelectObject acForm, , True
DoCmd.Minimize
End Sub

It causes the db window to go up and down continuously in a loop.

James
 
R

Rob Parker

Hi James,

I've just done some testing, and I agree - this is rather tricky. There is,
as you say, no OnRestore event, and there is also no direct way of referring
to the database window - you have to select something within that window to
cause it to become active.

I tried the Activate event, and got the minimize/restore cycling (until it
times out). So that's a no-go.

However, I did get this to work, using the form's resize event, and testing
the form's height to determine whether it is minimized.

Private Sub Form_Resize()
If Me.WindowHeight <> 465 Then 'Height of minimized window
'Select and minimize database window
DoCmd.SelectObject acTable, , True
DoCmd.Minimize
Else
'Select and restore database window
DoCmd.SelectObject acTable, , True
DoCmd.Restore
End If
End Sub

Maybe that will suffice for what you want. If your form is sizeable, the
code also runs when you resize the form; it also runs if you maximize the
form; in both cases, there's a switch of focus to the database window (in
the second case it maximizes and then minimizes), but there's no cycling of
windows.

HTH,

Rob
 

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