I am trying to put a simple search button on a form that will allow a user to enter in a Work Order number and click the search button to go to that record.
The code is:
Dim rs As Recordset
Dim Bkm As String
Dim stWorkOrder As Integer
stWorkOrder = Me.[SrchWO]
Set rs = Me.RecordsetClone
rs.FindFirst ("[Work Order] =" & stWorkOrder)
If rs.NoMatch Then
MsgBox "No records were found for this work order number"
Else
Bkm = rs.Bookmark
rs.Close
Me.Bookmark -Bkm
End If
SrchWO is the user's input field and Work Order is the field I want to search on.
Access does not like this code. At first, it could not find the Work Order reference. I've tried different variations of parenthesis, quote marks, etc. Now, it is telling me "Method or Data Member not found" on the rs.FindFirst.
Can someone tell me what I'm doing wrong here. I've spent hours on something that probably should have taken minutes.
The code is:
Dim rs As Recordset
Dim Bkm As String
Dim stWorkOrder As Integer
stWorkOrder = Me.[SrchWO]
Set rs = Me.RecordsetClone
rs.FindFirst ("[Work Order] =" & stWorkOrder)
If rs.NoMatch Then
MsgBox "No records were found for this work order number"
Else
Bkm = rs.Bookmark
rs.Close
Me.Bookmark -Bkm
End If
SrchWO is the user's input field and Work Order is the field I want to search on.
Access does not like this code. At first, it could not find the Work Order reference. I've tried different variations of parenthesis, quote marks, etc. Now, it is telling me "Method or Data Member not found" on the rs.FindFirst.
Can someone tell me what I'm doing wrong here. I've spent hours on something that probably should have taken minutes.