LIKE Operator in VBA

Status
Not open for further replies.

preethi

Registered User.
Local time
Yesterday, 16:07
Joined
Nov 5, 2007
Messages
30
Hi All,

I was trying to use the query given below in VBA. But its not working properly.

Dim searchwrd As String
searchwrd = InputBox("Enter the text to be searched")
str = "SELECT * FROM tblPurchaseOrder WHERE YMEOrderRef Like '" & searchwrd & "'"
rs.Open str, cn, adOpenDynamic, adLockOptimistic
Debug.Print str
If Not rs.EOF Then
MsgBox "hi"
End If
rs.Close

I entered some data that will give outputs in the query in access. But in VBA the same search data showing as rs is closed.

I hope anyone can give me a proper guidence.

Thanks & Regards

Preethi Renjith
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom