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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to prevent losing screen settings

Status
Not open for further replies.

pleasehelpalot

Instructor
Oct 4, 2005
92
US
Whenever I use a command button that opens a report in screen view the upper right of the report screen has two "X's". If I click the upper "X" it exits the database. That's OK, but if I click the lower "X" associated with the report, it returns to the previous screen only the settings are disabled and the form expands to the entire screen and the text is off centered. Is there a way to prevent this and have the screen appear as it did before opening the report.
 
use the report_close() event and look at setting the form size from there. You can probable use a resize event. here is what I found in help on that:
Resize Event
See AlsoApplies ToExampleSpecificsThe Resize event occurs when a form is opened and whenever the size of a form changes.

Private Sub Form_Resize()
Remarks
To run a macro or event procedure when this event occurs, set the OnResize property to the name of the macro or to [Event Procedure].

This event occurs if you change the size of the form in a macro or event procedure— for example, if you use the MoveSize action in a macro to resize the form.

By running a macro or an event procedure when a Resize event occurs, you can move or resize a control when the form it's on is resized. You can also use a Resize event to recalculate variables or reset properties that may depend on the size of the form.

When you first open a form, the following events occur in this order:

Open ? Load ? Resize ? Activate ? Current


Note You need to be careful if you use a MoveSize, Maximize, Minimize, or Restore action (or the corresponding methods of the DoCmd object) in a Resize macro or event procedure. These actions can trigger a Resize event for the form, and thus cause a cascading event.


Example
The following example shows how a Resize event procedure can be used to repaint a form when it is maximized. When the user clicks a command button labeled "Maximize," the form is maximized and the Resize event is triggered.

To try the example, add the following event procedures to a form named Contacts that contains a command button named Maximize:

Private Sub Maximize_Click()
DoCmd.Maximize
End Sub

Private Sub Form_Resize()
Forms!Contacts.Repaint
End Sub



misscrf

It is never too late to become what you could have been ~ George Eliot
 
With the help of a colleague, the solution was easier than we thought:

OnActivate Event of the form "DoCmd.Restore
 
good to know. Thank you for posting solution. I am thinking I could use this in a few places.

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top