Prev: refresh/requery subform
Next: 1 combo box populating more than one field and retaining info to t
From: Me.Frustrated = True on 11 Jan 2010 17:54 I wrote the stuff below to try to restore the defaults. I also put code in the OnClick event of both the "grow" and "shrink" buttons to count the number of times the form was magnified or de-magnified (magnify adds 1, de-magnify subtracts 1,) and store that count in the form's "Tag" property. Then I used the Tag value (an integer) to create a "multiplier." In theory, dividing each of the form's controls and dimensions by the formula (1.1 ^ mult) should take them back to the original sizes, but it doesn't: *** code start *** Public Function DefaultSize() Dim strForm As Form Dim ctl As Control Dim dflt As Double Dim mult As Long Set strForm = Screen.ActiveForm mult = strForm.Tag dflt = 1.1 ^ mult 'On Error GoTo err_blocker Do While mult > 0 With strForm .Width = strForm.Width / dflt .Detail.Height = strForm.Detail.Height / dflt .FormHeader.Height = strForm.FormHeader.Height / dflt End With For Each ctl In strForm.Controls If ctl.Tag <> "NoResize" Then If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox _ Or ctl.ControlType = acLabel Or ctl.ControlType = acCommandButton Then ctl.Height = ctl.Height / dflt ctl.Width = ctl.Width / dflt ctl.FontSize = ctl.FontSize / dflt ctl.Left = ctl.Left / dflt ctl.Top = ctl.Top / dflt End If End If Next Loop RunCommand acCmdSizeToFitForm exit_here: Exit Function err_blocker: MsgBox (Err.Number & ", " & Err.Description) Resume exit_here End Function *** code end *** "John W. Vinson" wrote: > > That would probably help. The only way I can think of would be to store the > current magnification scale in a VBA variable so that you can "undo" it, or to > store the default dimensions similarly. > -- > > John W. Vinson [MVP] > . >
First
|
Prev
|
Pages: 1 2 Prev: refresh/requery subform Next: 1 combo box populating more than one field and retaining info to t |