subform reference question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello - I use code like this in the after update event of cboFindCust, and
the code works as expected on several of my forms.

Dim strSrch As String
strSrch = "custID = " & cboFindCust.Column(0)
Me.RecordsetClone.FindFirst strSrch
Me.Bookmark = Me.RecordsetClone.Bookmark
Me!cboFindCust = Null

My problem comes when cboFindCust is on a main form but the CustID records
are on a subform. How do I change the syntax to find the matching record on
the subform?
 
Marshall - thanks for your quick response. I was mishandling the subform
reference. By the way, I had to change Me.Bookmark = .Bookmark to
Me.subformcontrol.Form.Bookmark = .Bookmark in the 5th line.

Dim strSrch As String
strSrch = "custID = " & cboFindCust.Column(0)
With Me.subformcontrol.Form.RecordsetClone
.FindFirst strSrch
If Not .NoMatch Then Me.subformcontrol.Form.Bookmark = .Bookmark
End With
Me!cboFindCust = Null

Thanks again
 
Sarah said:
Hello - I use code like this in the after update event of cboFindCust, and
the code works as expected on several of my forms.

Dim strSrch As String
strSrch = "custID = " & cboFindCust.Column(0)
Me.RecordsetClone.FindFirst strSrch
Me.Bookmark = Me.RecordsetClone.Bookmark
Me!cboFindCust = Null

My problem comes when cboFindCust is on a main form but the CustID records
are on a subform. How do I change the syntax to find the matching record on
the subform?


Dim strSrch As String
strSrch = "custID = " & cboFindCust.Column(0)
With Me.subformcontrol.Form.RecordsetClone
.FindFirst strSrch
If Not .NoMatch Then Me.Bookmark = .Bookmark
End With
Me!cboFindCust = Null
 
Sarah said:
Marshall - thanks for your quick response. I was mishandling the subform
reference. By the way, I had to change Me.Bookmark = .Bookmark to
Me.subformcontrol.Form.Bookmark = .Bookmark in the 5th line.

Dim strSrch As String
strSrch = "custID = " & cboFindCust.Column(0)
With Me.subformcontrol.Form.RecordsetClone
.FindFirst strSrch
If Not .NoMatch Then Me.subformcontrol.Form.Bookmark = .Bookmark
End With
Me!cboFindCust = Null


Good catch. Glad you got it working in spite of my
omission.
 
Back
Top