patriciaxxx
Programmer
I need flicker free form resizing of a sizable Access form, when there is a minimum size limit controlled by the form's Resize event, and the user tries to change the size.
The following code (which I did not write and do not fully understand) does accomplish this, however looking at it I believe it is intended for a msform (UserForm) not an Access form.
So can anybody modify the code so that it works with an Access form?
The following code (which I did not write and do not fully understand) does accomplish this, however looking at it I believe it is intended for a msform (UserForm) not an Access form.
So can anybody modify the code so that it works with an Access form?
Code:
[COLOR=#204A87]Private Const MyFormWd As Long = 5000
Private Const MyFormHt As Long = 6000
'********************
' Form_Resize
' Resize the form
'********************
Private Sub Form_Resize()
Select Case Me.WindowState
Case vbMinimized
Exit Sub
Case vbNormal
'if too small...
If Me.Width < MyFormWd _
Or Me.Height < MyFormHt Then
With Me.tmrResize 'smooth w/timer
.Enabled = False 'turn timer off
DoEvents 'screen catch up
.Enabled = True 'restart timer
End With
Exit Sub 'let timer do work
End If
End Select
'
'other control arrangement code goes here.
'
End Sub
'********************
' tmrResize_Timer
' Check Win for too small
'********************
Private Sub tmrResize_Timer()
'
'turn off timer
'
Me.tmrResize.Enabled = False
'
'do nothing if minimized
'
If Me.WindowState = vbMinimized Then
Exit Sub
End If
'
'resize to minimum dims
'
If Me.Width < MyFormWd Then
Me.Width = MyFormWd
End If
If Me.Height < MyFormHt Then
Me.Height = MyFormHt
End If
End Sub
[/color]