I made my own navigation form where I use the SubForm control to switch forms in and out. It is working great except I have a few forms that I can't resize to fit nicely in the subform control. see image I've been struggling with this for a few weeks and have tried numerous things. My latest attempt was to try and implement isladogs Move Forms & Controls example... but I can't get it to resize.
I've tried using the onResize event of a form and even though I see the difference in sizes between the Custom Nav form and the form I am adding to the SubForm control, it just flickers and doesn't resize.
I have the anchoring for the form controls, ie. listbox, subform, tabcontrol etc. set to down and accross.
I've also tried adding a procedure to my on side button click and even added Refresh to see if that gets it to work, but no luck.
Anyone have any ideas about this?
Thanks,
Sheri
Private Sub ResizeLaunchedForm(ByRef sFrm As Access.Form)
Dim iHeight As Integer, iWidth As Integer
Dim igrpTopMenuH As Integer, igrpTopMenuW As Integer
Dim igrpSideMenuH As Integer, igrpSideMenuW As Integer
Dim iNavSubH As Integer, iNavSubW As Integer
Dim iFrmHeadH As Integer, iFrmHeadW As Integer
Dim iFrmDetailH As Integer, iFrmDetailW As Integer
Dim iFrmFootH As Integer, iFrmFootW As Integer
Dim iFrmTotalH As Integer, iFrmTotalW As Integer
Dim iNavFrmDetailH As Integer, iNavFrmDetailW As Integer
Dim iNavWindowW As Integer
Dim iTotalWidth As Integer, iTotalHeight As Integer
Dim fNav As Access.Form, iNavBarH As Integer
Dim sSub As SubForm
Dim cnt As Control, iCntH As Integer
Dim gSide As OptionGroup
Dim gTop As OptionGroup
Dim iLaunchedHeader As Integer
iHeight = sFrm.WindowHeight
iHeight = sFrm.InsideHeight
iWidth = sFrm.WindowWidth
With sFrm.Section(acHeader)
iFrmHeadH = IIf(.Visible, .Height, 0)
End With
With sFrm.Section(acDetail)
iFrmDetailH = IIf(.Visible, .Height, 0)
End With
With sFrm.Section(acFooter)
iFrmFootH = IIf(.Visible, .Height, 0)
End With
iFrmTotalH = iFrmHeadH + iFrmDetailH + iFrmFootH
Set fNav = Forms!frmCustomNav.Form
Set cnt = fNav.fSubForm
If TypeOf cnt Is SubForm Then
iNavSubH = cnt.Height
iNavSubW = cnt.Width
End If
'
Set gSide = fNav.grpSideMenu
igrpSideMenuH = gSide.Height
igrpSideMenuW = gSide.Width
Set gTop = fNav.grpTopMenu
igrpTopMenuH = gTop.Height
igrpTopMenuW = gTop.Width
'
iNavBarH = fNav.navHeader.Height
iNavFrmDetailH = fNav.Section(acDetail).Height
iNavFrmDetailW = fNav.InsideWidth
iTotalHeight = iNavFrmDetailH + igrpTopMenuH + iNavBarH '+ igrpSideMenuH '- igrpTopMenuH - iNavBarH
'iLaunchedHeader = sfrm.Section(acHeader).Height
'iTotalHeight = iNavFrmDetailH + iLaunchedHeader '- igrpTopMenuH - iNavBarH
'iTotalWidth = iNavFrmDetailW '- igrpSideMenuW
sFrm.Section(acDetail).Height = iTotalHeight '+ iLaunchedHeader
sFrm.InsideHeight = iTotalHeight '+ iLaunchedHeader
sFrm.InsideWidth = iTotalWidth
End Sub
Public Sub LaunchNavSideForm(ByVal sFormName As String, ByVal LWidth As Long, ByVal LHeight As Long, ByRef sFrm As Access.Form)
Dim sSubForm As Access.Form
Dim sName As String
Dim sFrmLaunch As Access.Form
Dim fSubForm As SubForm
Dim fNav As Access.Form
Dim iNavSubH As Integer
Set fNav = Forms!frmCustomNav.Form
sFrm.fSubForm.SourceObject = sFormName
Set sFrmLaunch = ReturnCustomNavForm
If Not sFrmLaunch Is Nothing Then
'sFrmLaunch.InsideHeight = LHeight
'sFrmLaunch.InsideWidth = LWidth
' sFrmLaunch.Detail.Height = LHeight
sName = sFrmLaunch.Name
iNavSubH = fNav.Section(acDetail).Height
sFrmLaunch.Section(acDetail).Height = iNavSubH
sFrmLaunch.Refresh
Set sSubForm = ReturnCustomNavSubForm(sFormName)
If Not sSubForm Is Nothing Then
sSubForm.InsideHeight = LHeight
End If
End If
Set sFrm = Nothing
Set sFrmLaunch = Nothing
Set sSubForm = Nothing
End Sub
'Private Sub Form_Resize()
'Dim fNav As Access.Form
'Dim cnt As Control
'Dim iNavSubH As Integer, iNavSubW As Integer
'Dim sName As String, sFrm As Access.Form
'Dim iMeFrm As Integer
'
'Set fNav = Forms!frmCustomNav.Form
'
'Set sFrm = Me.Parent
'sName = sFrm.Name
'iNavSubH = sFrm.Section(acDetail).Height
'iMeFrm = Me.WindowHeight
'Me.InsideHeight = iNavSubH
''Set cnt = fNav.fSubForm
''If TypeOf cnt Is SubForm Then
'' iNavSubH = cnt.Height
'' iNavSubW = cnt.Width
''End If
'''
''Set gSide = fNav.grpSideMenu
''igrpSideMenuH = gSide.Height
''igrpSideMenuW = gSide.Width
''
''Set gTop = fNav.grpTopMenu
''igrpTopMenuH = gTop.Height
''igrpTopMenuW = gTop.Width
'''
''iNavBarH = fNav.navHeader.Height
''iNavFrmDetailH = fNav.Section(acDetail).Height
'
'End Sub
I've tried using the onResize event of a form and even though I see the difference in sizes between the Custom Nav form and the form I am adding to the SubForm control, it just flickers and doesn't resize.
I have the anchoring for the form controls, ie. listbox, subform, tabcontrol etc. set to down and accross.
I've also tried adding a procedure to my on side button click and even added Refresh to see if that gets it to work, but no luck.
Anyone have any ideas about this?
Thanks,
Sheri
Private Sub ResizeLaunchedForm(ByRef sFrm As Access.Form)
Dim iHeight As Integer, iWidth As Integer
Dim igrpTopMenuH As Integer, igrpTopMenuW As Integer
Dim igrpSideMenuH As Integer, igrpSideMenuW As Integer
Dim iNavSubH As Integer, iNavSubW As Integer
Dim iFrmHeadH As Integer, iFrmHeadW As Integer
Dim iFrmDetailH As Integer, iFrmDetailW As Integer
Dim iFrmFootH As Integer, iFrmFootW As Integer
Dim iFrmTotalH As Integer, iFrmTotalW As Integer
Dim iNavFrmDetailH As Integer, iNavFrmDetailW As Integer
Dim iNavWindowW As Integer
Dim iTotalWidth As Integer, iTotalHeight As Integer
Dim fNav As Access.Form, iNavBarH As Integer
Dim sSub As SubForm
Dim cnt As Control, iCntH As Integer
Dim gSide As OptionGroup
Dim gTop As OptionGroup
Dim iLaunchedHeader As Integer
iHeight = sFrm.WindowHeight
iHeight = sFrm.InsideHeight
iWidth = sFrm.WindowWidth
With sFrm.Section(acHeader)
iFrmHeadH = IIf(.Visible, .Height, 0)
End With
With sFrm.Section(acDetail)
iFrmDetailH = IIf(.Visible, .Height, 0)
End With
With sFrm.Section(acFooter)
iFrmFootH = IIf(.Visible, .Height, 0)
End With
iFrmTotalH = iFrmHeadH + iFrmDetailH + iFrmFootH
Set fNav = Forms!frmCustomNav.Form
Set cnt = fNav.fSubForm
If TypeOf cnt Is SubForm Then
iNavSubH = cnt.Height
iNavSubW = cnt.Width
End If
'
Set gSide = fNav.grpSideMenu
igrpSideMenuH = gSide.Height
igrpSideMenuW = gSide.Width
Set gTop = fNav.grpTopMenu
igrpTopMenuH = gTop.Height
igrpTopMenuW = gTop.Width
'
iNavBarH = fNav.navHeader.Height
iNavFrmDetailH = fNav.Section(acDetail).Height
iNavFrmDetailW = fNav.InsideWidth
iTotalHeight = iNavFrmDetailH + igrpTopMenuH + iNavBarH '+ igrpSideMenuH '- igrpTopMenuH - iNavBarH
'iLaunchedHeader = sfrm.Section(acHeader).Height
'iTotalHeight = iNavFrmDetailH + iLaunchedHeader '- igrpTopMenuH - iNavBarH
'iTotalWidth = iNavFrmDetailW '- igrpSideMenuW
sFrm.Section(acDetail).Height = iTotalHeight '+ iLaunchedHeader
sFrm.InsideHeight = iTotalHeight '+ iLaunchedHeader
sFrm.InsideWidth = iTotalWidth
End Sub
Public Sub LaunchNavSideForm(ByVal sFormName As String, ByVal LWidth As Long, ByVal LHeight As Long, ByRef sFrm As Access.Form)
Dim sSubForm As Access.Form
Dim sName As String
Dim sFrmLaunch As Access.Form
Dim fSubForm As SubForm
Dim fNav As Access.Form
Dim iNavSubH As Integer
Set fNav = Forms!frmCustomNav.Form
sFrm.fSubForm.SourceObject = sFormName
Set sFrmLaunch = ReturnCustomNavForm
If Not sFrmLaunch Is Nothing Then
'sFrmLaunch.InsideHeight = LHeight
'sFrmLaunch.InsideWidth = LWidth
' sFrmLaunch.Detail.Height = LHeight
sName = sFrmLaunch.Name
iNavSubH = fNav.Section(acDetail).Height
sFrmLaunch.Section(acDetail).Height = iNavSubH
sFrmLaunch.Refresh
Set sSubForm = ReturnCustomNavSubForm(sFormName)
If Not sSubForm Is Nothing Then
sSubForm.InsideHeight = LHeight
End If
End If
Set sFrm = Nothing
Set sFrmLaunch = Nothing
Set sSubForm = Nothing
End Sub
'Private Sub Form_Resize()
'Dim fNav As Access.Form
'Dim cnt As Control
'Dim iNavSubH As Integer, iNavSubW As Integer
'Dim sName As String, sFrm As Access.Form
'Dim iMeFrm As Integer
'
'Set fNav = Forms!frmCustomNav.Form
'
'Set sFrm = Me.Parent
'sName = sFrm.Name
'iNavSubH = sFrm.Section(acDetail).Height
'iMeFrm = Me.WindowHeight
'Me.InsideHeight = iNavSubH
''Set cnt = fNav.fSubForm
''If TypeOf cnt Is SubForm Then
'' iNavSubH = cnt.Height
'' iNavSubW = cnt.Width
''End If
'''
''Set gSide = fNav.grpSideMenu
''igrpSideMenuH = gSide.Height
''igrpSideMenuW = gSide.Width
''
''Set gTop = fNav.grpTopMenu
''igrpTopMenuH = gTop.Height
''igrpTopMenuW = gTop.Width
'''
''iNavBarH = fNav.navHeader.Height
''iNavFrmDetailH = fNav.Section(acDetail).Height
'
'End Sub