Minimizing a form, in an event off a command button.

A

Azza

Gday,

I've got a form with a button that opens another form, through an event
that grabs existing and uses it to display specific information on the
second form. I want to be able to minimize the first form, through the
code in the event. At first I thought this would work;

DoCmd.Minimize

But that actually shrinks the entire database. I've also tried;

Dim stMin As String

stMin = "Minimize" *(Minimize is a macro made, with just the Minimize
command set)*

DoCmd.OpenFunction stMin

But that doesn't work either, and no OpenMacro can be found.

Any ideas? Thanks.
 
6

'69 Camaro

Hi, Azza.
I want to be able to minimize the first form, through the
code in the event.

Minimize the first form before the second form is opened, not during a later
event. You can do so in the button's click event. For example, if your
button is named OpenFormBtn and your second form is named MyOtherForm, then
the following code would minimize the current form and open the MyOtherForm
form:


Private Sub OpenFormBtn_Click()

On Error GoTo ErrHandler

DoCmd.Minimize
DoCmd.OpenForm "MyOtherForm"

Exit Sub

ErrHandler:

MsgBox "Error in OpenFormBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub ' OpenFormBtn_Click( )

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
A

Azza

Hey Camaro,

I tried that set of commands you mentioned before. And I still have the
entire database minimize, and it is indeed before the other forms gets
opened. But when I close that form, it'll revert back to the previous
form (which it should be doing) and I click the button on the first
form again and it minimizes just fine. Instead of the whole database.
 
6

'69 Camaro

Hi, Azza.
I tried that set of commands you mentioned before. And I still have the
entire database minimize

Then some other code or macro is executing to minimize the window. Search
through your VBA code and the Properties dialog windows of both the first
and second forms. It's either a DoCmd.Minimize line of code or a call to
the Minimize Macro that you've forgotten about. My guess is that the macro
is being called.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
A

Azza

Camaro,

Howdy, I had a look through out the code and, also that code calling
the macro never worked :p so I'd deleted it straight away.

However I tried moving the Minimize command to a new position, heres
what it was before;

stDocName = "Result - Summary Lease Record View"

stLinkCriteria = "[THIRD PARTY]=" & "'" & Me![THIRD PARTY] & "'"

DoCmd.Minimize
DoCmd.OpenForm stDocName, , , stLinkCriteria

Now this is what it looks like;

DoCmd.Minimize
stDocName = "Result - Summary Lease Record View"
stLinkCriteria = "[THIRD PARTY]=" & "'" & Me![THIRD PARTY] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

What this has done, is it's fixed the whole database minimizing
problem, but it still maintains focus on the first form. So it will
open Result - Summary Lease Record View but the first form while
minimized is still maintaining focus rather than shifting it to the
next form. AND until I close the first form, the second wont gain
focus.

A wierd pickle indeed heh.

Cheers,
Azza
 
A

Azza

Hello again,

I've given up on trying to minimize the window, instead I've just had
the form close.

Either way this rids of the seeing the other window problem, as well as
the minimizing window problem.

But thanks your help anyway :)

Cheers,

Azza.
 
6

'69 Camaro

Hi, Azza.

I can't duplicate the effect you're experiencing, because I'm using Access
2003 SP-1. But I have a sneaky suspicion what's causing your problem.

Open the first form in Design View, then open the Properties dialog window.
Select the "Other" tab and set the Pop Up and Modal Properties both to "No."
Save the form and open it in Form View, then select the button that opens
the second form.

If that doesn't fix it, check the VBA procedure that opens the first form.
Do you see acDialog as one of the arguments? If so, remove it, save and
compile the code. Then test your forms again.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


Azza said:
Camaro,

Howdy, I had a look through out the code and, also that code calling
the macro never worked :p so I'd deleted it straight away.

However I tried moving the Minimize command to a new position, heres
what it was before;

stDocName = "Result - Summary Lease Record View"

stLinkCriteria = "[THIRD PARTY]=" & "'" & Me![THIRD PARTY] & "'"

DoCmd.Minimize
DoCmd.OpenForm stDocName, , , stLinkCriteria

Now this is what it looks like;

DoCmd.Minimize
stDocName = "Result - Summary Lease Record View"
stLinkCriteria = "[THIRD PARTY]=" & "'" & Me![THIRD PARTY] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

What this has done, is it's fixed the whole database minimizing
problem, but it still maintains focus on the first form. So it will
open Result - Summary Lease Record View but the first form while
minimized is still maintaining focus rather than shifting it to the
next form. AND until I close the first form, the second wont gain
focus.

A wierd pickle indeed heh.

Cheers,
Azza



'69 Camaro said:
Hi, Azza.


Then some other code or macro is executing to minimize the window.
Search
through your VBA code and the Properties dialog windows of both the first
and second forms. It's either a DoCmd.Minimize line of code or a call to
the Minimize Macro that you've forgotten about. My guess is that the
macro
is being called.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
A

Azza

Hi Camaro,

I had a look at the form settings for the first form. Neither of those
settings are set to Yes. Both are No. So I checked out the vba in the
event procedure for the command button, and acDialog wasnt to be found.


I've found a temporary solution is just to close the form as the next
one gets opened. Maybe if I try redoing the whole form later on, it may
just fix it. Not sure.

Also I'm running 2003 SP-2. Maybe theres a bug I've somehow found :p
Haha.

Ah well, either way thanks alot for your help. I'm re learning Access
all over again, this new job is testing me and it certaintly helped
either way.

Thanks again,

Azza.
 
6

'69 Camaro

Hi, Azza.
So I checked out the vba in the
event procedure for the command button, and acDialog wasnt to be found.

The event procedure that opens the first form, not the second form.
Correct? The first form being in dialog mode would account for the inablity
to set focus to any other form until the first form is closed.
I've found a temporary solution is just to close the form as the next
one gets opened. Maybe if I try redoing the whole form later on, it may
just fix it. Not sure.

I'm glad you've found a workaround. At least it isn't minimizing the whole
window any more.
Also I'm running 2003 SP-2. Maybe theres a bug I've somehow found :p

It's possible.
Ah well, either way thanks alot for your help.

You're welcome. I'm sorry I didn't solve your problem, though. I suggest
that you repost this question and see whether anyone else has some ideas
that may help.

Good luck.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

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