Prev: openform filter
Next: Chart Total
From: WDSnews on 18 Mar 2010 17:15 This code always works at first, but then goes amiss. While the symptoms are consistent, I haven't found the circumstances to consistently trigger the problem. However once triggered, the problem happens consistently until the form is closed and re-opened. Here's the goal: I have a form showing one record at a time. It has a subform showing the same data in a datasheet. When I advance a record on the parent form, the subform should highlight the same record displayed on the parent. When I click a record in the subform, the parent form should jump to the same record. The parent works perfectly. I can advance records. I can click a record in the subform and see the same record on the parent form. Here's the problem: Sometimes a problem condition is triggered and from then on, it always has a problem until I close the form and re-open it. When the condition is triggered, I'm unable to highlight a record in the subform on the first click. The symptoms are consistent. Rather than highlight the field and record I've clicked, it highlights the ID field of a specific different record. Today that record is the 11th of 46 records. No matter which field or which record I click on, the first click results in highlighting the ID field of record #11. However, even though the wrong record is highlighted in the subform, the parent form advances to the correct record. It takes a second click before the correct record and field is highlighted on the subform. Here's the code: parent form code ------------------------- Private Sub Form_Current() Dim frm As Form Dim rst As Object 'Sync Order Candidates subform to Parent form Set frm = Me.sbfOrderCandidates.Form If frm.ID <> Me.ID Then Set rst = frm.Recordset.Clone With rst .FindFirst "ID = " & Me.ID If Not .NoMatch Then frm.Bookmark = .Bookmark End If End With End If sbf code ----------- Private Sub Form_Current() Dim frm As Form Dim rst As Object Set frm = Me.Parent If frm.ID <> Me.ID Then Set rst = frm.Recordset.Clone With rst .FindFirst "ID = " & Me.ID If Not .NoMatch Then frm.Bookmark = .Bookmark End If End With End If End Sub I appreciate your comments. Thank you.
|
Pages: 1 Prev: openform filter Next: Chart Total |