What is wrong with this code?

T

Tanya

Hi
I have the following statement to close the form with the cmdReturnfrmData
button and when it is clicked it closes frmBehaviour [which is what I want],
but then instead of opening the form Data in Dialog, it opens it as maximum.

Private Sub cmdReturnfrmData_Click()
DoCmd.Close
DoCmd.OpenForm "Data", acNormal, , , , acDialog
End Sub

Can someone please tell me where I am going wrong?

Kind regards
Tanya
 
J

Jeanette Cunningham

Hi Tanya,
in access, if one form is maximized, all the forms open as maximized.
If one form is restored, all the forms open as restored.
You can use code on the on activate event of a form to restore or maximize
it.

DoCmd.Maximize will maximize the form
DoCmd.Restore will restore the form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jason

I find that unreliable - I put the command immediately after the open event.
Jeanette Cunningham said:
Hi Tanya,
in access, if one form is maximized, all the forms open as maximized.
If one form is restored, all the forms open as restored.
You can use code on the on activate event of a form to restore or maximize
it.

DoCmd.Maximize will maximize the form
DoCmd.Restore will restore the form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Tanya said:
Hi
I have the following statement to close the form with the
cmdReturnfrmData
button and when it is clicked it closes frmBehaviour [which is what I
want],
but then instead of opening the form Data in Dialog, it opens it as
maximum.

Private Sub cmdReturnfrmData_Click()
DoCmd.Close
DoCmd.OpenForm "Data", acNormal, , , , acDialog
End Sub

Can someone please tell me where I am going wrong?

Kind regards
Tanya
 
B

banem2

Hi Tanya,
in access, if one form is maximized, all the forms open as maximized.
If one form is restored, all the forms open as restored.
You can use code on the on activate event of a form to restore or maximize
it.
DoCmd.Maximize will maximize the form
DoCmd.Restore will restore the form.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Tanya said:
Hi
I have the following statement to close the form with the
cmdReturnfrmData
button and when it is clicked it closes frmBehaviour [which is what I
want],
but then instead of opening the form Data in Dialog, it opens it as
maximum.
Private Sub cmdReturnfrmData_Click()
   DoCmd.Close
   DoCmd.OpenForm "Data", acNormal, , , , acDialog
End Sub
Can someone please tell me where I am going wrong?
Kind regards
Tanya

There is also one specific case when form does not open maximized. You
can set PopUp: Yes and it will open not as maximized, but this type of
form remains on top of other windows.

However, I am not open any form maximized as I don't know screen
resolution on target PC. On large screens big gray area looks ugly.
Just my $.02.

Regards,
Branislav Mihaljev
Microsoft Access MVP
 
T

Tanya

Thank you very much to Jeanette and Jason, you have been very helpful.

Regards
Tanya
 

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