SQLCommandLike




Dim ds as recordset, db as database
Dim criteria$
Const databasenaam="c:\win\test.mdb"
Const tablename="testing"
'________________________________________________________


Sub Form1_load
set db=opendatabase(databasename)
txtSearch.text=""
end sub
'________________________________________________________


Sub cmdGo_Click
Dim SQL$
criteria$= "*" & txtSearch & "*"
SQL$= "SELECT * FROM " & tablename & " WHERE name ='" & _
criteria$ & "'"
set ds = db.openrecordset(SQL$)
do while not ds.eof
List1.additem ds("name") & " " & ds("adress")
ds.movenext
loop
ds.close
end Sub

Make a form with
a listbox = List1
an textbox = txtSearch
a commandbutton = cmdGo
assuming there's a database in the 'c:\win' directorie with the
name 'test.md' with a table called 'testing' which contains two
fields: 'name' and 'adress' on Form1.general










( sqlcommandlike.html )- by Paolo Puglisi - Modifica del 17/12/2023