J
JR
I can't seem to find much info at all on this one.. I'd like to to
bind to a disconnected recordset on my parent form and use the chapter
to bind to in the subform. I thought this would acheive automatic
synchronization since navigating through the parent set filters the
chapters accordingly, but the code below simply displays all child
records in the sub form at all times. why doesn't this work? what is
the right way to do this? is the only way to set filters on a chapter
recordset clone for each parent record on the current event?
Private Sub Form_Load()
Dim workRS As New ADODB.Recordset
Dim cnn As New ADODB.Connection
cnn.Provider = "MSDataShape"
cnn.Properties("Data Provider") = "SQLOLEDB"
'...connection info...
cnn.Open
If Not Me.RecordSource = " " Then
workRS.CursorLocation = adUseClient
workRS.Open "SHAPE {select * from tblsite} " _
& "APPEND " _
& "( {SELECT * From tblsitecomponent} RELATE siteid to
siteid ) as components" _
, cnn, adOpenKeyset, adLockBatchOptimistic
workRS.ActiveConnection = Nothing
Set Me.Recordset = workRS
'set subform recordsource
Set Me.Controls("sensors").Form.Recordset = workRS("components").Value
workRS.Close
Set workRS = Nothing
End If
End Sub
bind to a disconnected recordset on my parent form and use the chapter
to bind to in the subform. I thought this would acheive automatic
synchronization since navigating through the parent set filters the
chapters accordingly, but the code below simply displays all child
records in the sub form at all times. why doesn't this work? what is
the right way to do this? is the only way to set filters on a chapter
recordset clone for each parent record on the current event?
Private Sub Form_Load()
Dim workRS As New ADODB.Recordset
Dim cnn As New ADODB.Connection
cnn.Provider = "MSDataShape"
cnn.Properties("Data Provider") = "SQLOLEDB"
'...connection info...
cnn.Open
If Not Me.RecordSource = " " Then
workRS.CursorLocation = adUseClient
workRS.Open "SHAPE {select * from tblsite} " _
& "APPEND " _
& "( {SELECT * From tblsitecomponent} RELATE siteid to
siteid ) as components" _
, cnn, adOpenKeyset, adLockBatchOptimistic
workRS.ActiveConnection = Nothing
Set Me.Recordset = workRS
'set subform recordsource
Set Me.Controls("sensors").Form.Recordset = workRS("components").Value
workRS.Close
Set workRS = Nothing
End If
End Sub