HillTJ
To train a dog, first know more than the dog..
- Local time
- Today, 05:12
- Joined
- Apr 1, 2019
- Messages
- 731
Hi, I've been using the form resize module kindly provided by Colin Riddington (guru) & Jamie Czernik and others on an application. It works well to auto resize my forms to suit varying monitor resolutions. I can swap between a small laptop and a large monitor all good. I have the application 'Calibration' (the latest version has been uploaded to this site under a different thread) installed on a shared network drive & database is not yet split & it works fine. However, I ran it on a different PC that has 32bit access runtime only installed & I get the following error message upon load 'Error 2462 - the section number you entered is invalid'. The code excerpt that causes the error is attached for reference (I did not include the full code).
Any ideas what this means & how to fix?
Any ideas what this means & how to fix?
Code:
Private Sub Resize(sngFactor As Single, frm As Access.Form)
Dim ctl As Access.Control
On Error GoTo ErrorHandler
'Resize height for each section:
With frm
.Width = .Width * sngFactor
.Section(Access.acHeader).Height = .Section(Access.acHeader).Height * sngFactor
.Section(Access.acDetail).Height = .Section(Access.acDetail).Height * sngFactor
.Section(Access.acFooter).Height = .Section(Access.acFooter).Height * sngFactor
End With
'Resize and locate each control:
For Each ctl In frm.Controls
If (ctl.ControlType <> Access.acPage) Then 'Ignore pages in TAB controls
With ctl
.Height = .Height * sngFactor
.Left = .Left * sngFactor
.Top = .Top * sngFactor
.Width = .Width * sngFactor
'next line moved back to individual control properties below
' .FontSize = .FontSize * sngFactor
' Enhancement by Myke Myers --------------------------------------->
'Fix certain combo box, list box and tab control properties:
Select Case .ControlType
Case acLabel, acCommandButton, acTextBox, acToggleButton
.FontSize = .FontSize * sngFactor
Case acListBox
.FontSize = .FontSize * sngFactor
.ColumnWidths = AdjustColumnWidths(.ColumnWidths, sngFactor)
Case acComboBox
.FontSize = .FontSize * sngFactor
.ColumnWidths = AdjustColumnWidths(.ColumnWidths, sngFactor)
.ListWidth = .ListWidth * sngFactor
Case acTabCtl
.FontSize = .FontSize * sngFactor
.TabFixedWidth = .TabFixedWidth * sngFactor
.TabFixedHeight = .TabFixedHeight * sngFactor
Case Else 'no other code here
'acRectangle, acCheckBox, acImage, acLine, acPageBreak, acSubform
'acOptionButton, acOptionGroup, acObjectFrame, acBoundObjectFrame
End Select
'------------------------------------> End enhancement by Myke Myers
End With
End If
Next ctl
ExitError:
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 999
Resume Next
Case 9999
Resume Next
Case Else
Call LogError(Err.Number, Err.Description, "Resize(sngFactor As Single, frm As Access.Form)")
Resume ExitError
End Select
End Sub