starclassic
Technical User
Hi,
Im still fairly new with ADO, but I have a back end database (tesing.mdb) with table tblCollectionsData and tblAdjustments which both have a relationship base on policynumber. Front end have mainfrm(tblCollections) and subform (tbladjustment).
I Have these code to connect to database and bind to the form (frmCollectionsData)and same thing for the subfrom (frmAdjustments).
But when I scroll thru the record on main form the subform will not display the data related to the main form.
The relationship have been established on the back end database. Any Idea how to go about this.
Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "Microsoft.Jet.OLEDB.4.0"
.Properties("Data Source").Value = _
"W:\RODP\DB Projects\Collections Database\Testing.mdb"
'.ConnectionString = ConnString
.Open
End With
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT * FROM tblCollectionsData"
.LockType = adLockBatchOptimistic
.CursorType = adOpenKeyset
.Open
End With
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
End Sub
Im still fairly new with ADO, but I have a back end database (tesing.mdb) with table tblCollectionsData and tblAdjustments which both have a relationship base on policynumber. Front end have mainfrm(tblCollections) and subform (tbladjustment).
I Have these code to connect to database and bind to the form (frmCollectionsData)and same thing for the subfrom (frmAdjustments).
But when I scroll thru the record on main form the subform will not display the data related to the main form.
The relationship have been established on the back end database. Any Idea how to go about this.
Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "Microsoft.Jet.OLEDB.4.0"
.Properties("Data Source").Value = _
"W:\RODP\DB Projects\Collections Database\Testing.mdb"
'.ConnectionString = ConnString
.Open
End With
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT * FROM tblCollectionsData"
.LockType = adLockBatchOptimistic
.CursorType = adOpenKeyset
.Open
End With
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
End Sub