Forum Discussion
Regression in v2605: Subform with overlapping controls breaks timer in unrelated form
I found another issue (sorry) which might be caused by the zoom-related changes in 2605. The following repro example works fine in 2604 (Monthly Enterprise Channel) but breaks in 2605 (Current Channel).
Again, this issue is unrelated to zooming itself.
Prepare database
The repro requires three forms and a few controls. Since those are tedious to get right manually, I wrote some VBA code to do that for us. Execute BuildRepro() in the Immediate Window to create the forms and controls.
Option Compare Database
Option Explicit
Public Sub BuildRepro()
CreateFormASubform
CreateFormA
CreateFormB
End Sub
Private Sub CreateFormASubform()
Dim frm As Form
Dim ctl As Control
Set frm = CreateForm()
Set ctl = CreateControl(frm.Name, acTextBox, acDetail, , , 345, 1140, 1746, 260)
ctl.TabStop = False
Const textBoxTop = 260
Set ctl = CreateControl(frm.Name, acTextBox, acDetail, , , 56, textBoxTop, 270, 270)
ctl.TabStop = False
Set ctl = CreateControl(frm.Name, acImage, acDetail, , , 56, 0, 270, 270)
Set ctl = CreateControl(frm.Name, acCommandButton, acDetail, , , 60, 795, 5895, 260)
SaveAndClose frm, "FormA_Subform"
End Sub
Private Sub CreateFormA()
Dim frm As Form
Dim ctl As Control
Set frm = CreateForm()
Set ctl = CreateControl(frm.Name, acSubform, acDetail, , , 100, 100, 3000, 3000)
ctl.SourceObject = "FormA_Subform"
SaveAndClose frm, "FormA"
End Sub
Private Sub CreateFormB()
Dim frm As Form
Dim ctl As Control
Set frm = CreateForm()
frm.TimerInterval = 1
Set ctl = CreateControl(frm.Name, acLabel, acDetail, , , 100, 100, 5000, 1000)
ctl.Name = "my_label"
ctl.Caption = "Waiting for Timer..."
frm.HasModule = True
frm.Module.InsertText _
"Private Sub Form_Timer()" & vbCrLf & _
" Me.TimerInterval = 0" & vbCrLf & _
" Me.my_label.Caption = ""Done""" & vbCrLf & _
"End Sub"
frm.OnTimer = "[Event Procedure]"
SaveAndClose frm, "FormB"
End Sub
Private Sub SaveAndClose(ByVal frm As Form, ByVal newname As String)
Dim oldname As String
oldname = frm.Name
DoCmd.Save acForm, oldname
DoCmd.Close acForm, oldname
DoCmd.Rename newname, acForm, oldname
End Sub
Run repro
1. Open FormA.
2. Open FormB (while FormA is still open).
Expected result: FormB opens completely, the timer runs and the label reads "Done".
Actual result: FormB opens "halfway" (it's visible, but it's tab is still missing, see screenshot below) and the label still shows "Waiting for Timer...". As soon as you right-click anywhere, the form finishes opening and the timer runs, changing the label to "Done".
Notes:
- I tried to make the repro as simple as possible. If you remove one of the controls from FormA_Subform (or enable TabStops), the problem disappears.
- It might have something to do with overlapping controls: If you change textBoxTop from 260 to 280, so that it no longer overlaps with the image, the problem also disappears.
- We need the overlapping controls because in our real code the subform is continuous and displays data at different indentation levels (like a treeview).
1 Reply
Hi Heinzi,
I have informed the Access team.
Servus
Karl
****************
Access Forever, News, DevCon
Access-Entwickler-Konferenz AEK