W
Wayne
Since Split Forms cannot be used as a subform I'm trying to make one
using two subforms. My relationship are (using Access 2010):
Main( 1 to M) to Subform_1
Subform_1 (1 to M) to Subform_A (Single Form)
Subform_1 (1 to M) to Subform_B (Datasheet)
Subform A and B have the same fields and use the same Record Source
table. Using the code below I can keep the two subforms synchronized,
even if I add or delete records in either form. My problem is when I
filter one subform, I loose sync with the other. The whole keeps
getting deeper trying to mimic this a Split Form. I keep thinking
someone must have done this already but I only found half-done
databases. Any help would be appreciated.
*********** CODE *************
' (Subform A & B have the same code, just form references are changed.
Private Sub Form_AfterDelConfirm(Status As Integer)
Me.Parent.Requery
End Sub
Private Sub Form_AfterUpdate()
Dim rst As DAO.Recordset
If IsNewRecord = True Then
NewRecordID = Str(Me.txtReportDetailID)
Me.Parent.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "ReportDetailID = " & NewRecordID
On Error Resume Next
Forms!frmReportMain!frmMonthYear.Form!
frmReportDetails_2.Form.Bookmark = rst.Bookmark
On Error GoTo 0
rst.Close
Set rst = Nothing
NewRecordID = 0
IsNewRecord = False
End If
End Sub
Private Sub Form_Current()
Dim rst As DAO.Recordset, strSearchName As String
If Me.NewRecord Then
IsNewRecord = True
Exit Sub
Else
Set rst = Me.RecordsetClone
strSearchName = Str(Me.ReportDetailID)
rst.FindFirst "ReportDetailID = " & strSearchName
On Error Resume Next
Forms!frmReportMain!frmMonthYear.Form!
frmReportDetails_2.Form.Bookmark = rst.Bookmark
On Error GoTo 0
End If
rst.Close
Set rst = Nothing
End Sub
using two subforms. My relationship are (using Access 2010):
Main( 1 to M) to Subform_1
Subform_1 (1 to M) to Subform_A (Single Form)
Subform_1 (1 to M) to Subform_B (Datasheet)
Subform A and B have the same fields and use the same Record Source
table. Using the code below I can keep the two subforms synchronized,
even if I add or delete records in either form. My problem is when I
filter one subform, I loose sync with the other. The whole keeps
getting deeper trying to mimic this a Split Form. I keep thinking
someone must have done this already but I only found half-done
databases. Any help would be appreciated.
*********** CODE *************
' (Subform A & B have the same code, just form references are changed.
Private Sub Form_AfterDelConfirm(Status As Integer)
Me.Parent.Requery
End Sub
Private Sub Form_AfterUpdate()
Dim rst As DAO.Recordset
If IsNewRecord = True Then
NewRecordID = Str(Me.txtReportDetailID)
Me.Parent.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "ReportDetailID = " & NewRecordID
On Error Resume Next
Forms!frmReportMain!frmMonthYear.Form!
frmReportDetails_2.Form.Bookmark = rst.Bookmark
On Error GoTo 0
rst.Close
Set rst = Nothing
NewRecordID = 0
IsNewRecord = False
End If
End Sub
Private Sub Form_Current()
Dim rst As DAO.Recordset, strSearchName As String
If Me.NewRecord Then
IsNewRecord = True
Exit Sub
Else
Set rst = Me.RecordsetClone
strSearchName = Str(Me.ReportDetailID)
rst.FindFirst "ReportDetailID = " & strSearchName
On Error Resume Next
Forms!frmReportMain!frmMonthYear.Form!
frmReportDetails_2.Form.Bookmark = rst.Bookmark
On Error GoTo 0
End If
rst.Close
Set rst = Nothing
End Sub