What is wrong with this code?

  • Thread starter Thread starter Tanya
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top