Quote:
Originally Posted by Eglute
I want to write sql sentence with LIKE operator. I wrote this code:
Private Sub Command8_Click()
List1.Clear
Set db = OpenDatabase("the path of my database")
Set rec = db.OpenRecordset("SELECT * From asmenu_info WHERE asmenu_info.pavarde LIKE '%Pet%';")
While Not rec.EOF
List1.AddItem rec!ID & " " & rec!Vardas & " " & rec!pavarde & " " & rec!Data
rec.MoveNext
Wend
rec.Close
db.Close
End Sub
and my program does nothing. I don't undestand how does LIKE work?
Hi,
I developed a VB app in the compact framework for a PDA and using SQL Sever CE and not MS access, but when I was doing something like this, I used this format:
I am assuming that you have assigned "Pet" as a string variable or something
i.e.
-
Dim Pet As String
-
Pet = "Dog"
-
-
etc...
-
-
Set rec = db.OpenRecordset("SELECT * From asmenu_info WHERE asmenu_info.pavarde LIKE ' " & Pet & " ' ")
-
But I am not sure if that would be the same for an Access DB