go to record????

  • Thread starter Thread starter KRISH
  • Start date Start date
K

KRISH

Hi!

In my table I have a field, form no in different formates
like M001, P001. Now I want to design a textbox for
entering form no and a button. Now I want to go to that
particular record by giving the form no in the text box
and pressing the button. My question is how to get the
record no in the table depending on the form no. Please
help.

Thanks in advance
Krish
 
Assuming you have:
- a form based that is bound to this table,
- the field containing the "M001" data is named "MyField",
- the text box is unbound (no control source), and is named "txtFind",
then you could do this in the AfterUpdate event procedure of the text box:

Private Sub txtFind_AfterUpdate()
Dim strWhere As String

If Not IsNull(Me.txtFind)
strWhere = "[MyField] = """ & Me.txtFind & """"
With Me.RecordsetClone
.FindFirst strWhere
If .NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub
 
Back
Top