I need to navigate to a control on a specific row on a subform. I have an control called PLY (think “line item #” in an order processing appl).
A user supplied search field = txtCurrentPly. (row selection via clicking is not an option)
I can get to the subform.
I can get the number of rows on the subform.
But my IF statement generates a “451” error.
I tried using the CurrentRecord property, but I simply don’t know how to use it.
Here’s some data
TxtCurrentPly = 2b (this is the data I want to find and change)
SfrmPly.Form.Ply (this is the subform) contains 7 rows
2
2a
2b
2c
2d
2e
2f
=============
Here’s my attempt:
Private Sub txtCurrentPly_AfterUpdate()
Dim sfRows
Dim x
sfRows = sfrmPly.Form.Count
x = 1
With sfrmPly.Form 'subform
For x = x To sfRows
If .Ply(x) = Me.txtCurrentPly Then -- code generates 451 error msg
.Ply(x).BackColor = vbBlue
.Ply(x).ForeColor = vbYellow
End If
Next x
End With
End Sub
=============
What is the correct way to do this?
Thanks
A user supplied search field = txtCurrentPly. (row selection via clicking is not an option)
I can get to the subform.
I can get the number of rows on the subform.
But my IF statement generates a “451” error.
I tried using the CurrentRecord property, but I simply don’t know how to use it.
Here’s some data
TxtCurrentPly = 2b (this is the data I want to find and change)
SfrmPly.Form.Ply (this is the subform) contains 7 rows
2
2a
2b
2c
2d
2e
2f
=============
Here’s my attempt:
Private Sub txtCurrentPly_AfterUpdate()
Dim sfRows
Dim x
sfRows = sfrmPly.Form.Count
x = 1
With sfrmPly.Form 'subform
For x = x To sfRows
If .Ply(x) = Me.txtCurrentPly Then -- code generates 451 error msg
.Ply(x).BackColor = vbBlue
.Ply(x).ForeColor = vbYellow
End If
Next x
End With
End Sub
=============
What is the correct way to do this?
Thanks