subform reference question

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?
 
G

Guest

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
 
M

Marshall Barton

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
 
M

Marshall Barton

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top