|
-
Aug 10th, 2006, 07:33 PM
#1
Thread Starter
Lively Member
[RESOLVED] PLEASE HELP.. I have problem on using the LIKE on SELECT... in vb program 6.0
I am having hard time to this, when i use the...
"select * from personalinfo where
personalinfo.lastname = " & "'" & txtlastname.Text & "'"
The above work to what i am expected... however, when i am using the....
"select * from personalinfo where
personalinfo.lastname LIKE " & "'" & txtlastname.Text & "'"
This does not work as what i want which the user can type just the first 3 letters or four or etc.... of the lastname... I am using the access database as my backend...
My input includes the asterist the textbox like "SACHEZ", i put "SANC*", but this is not recognized just want to know why and is there a bug on using LIKE word in VB 6.0?
PLEASE HELP... the code is there bellow
=============================================
Option Explicit
Dim Dbhrd As Connection
Dim RsQuery As Recordset
Private Sub Form_Load()
Set Dbhrd = New Connection
Set RsQuery = New Recordset
Dbhrd.CursorLocation = adUseServer
Dbhrd.Open "PROVIDER=microsoft.jet.oledb.4.0;" & _
"Data Source=r:\hrddatafile.mdb;" & _
"Persist Security Info=False;" & _
"Jet OLEDB atabase Password=" & vpassadmin
End Sub
Private Sub RSQueryOpen()
RsQuery.Source = "SELECT * From personalinfo " & _
"WHERE personalinfo!lastname LIKE " & _
"'" & txtlastname.Text & "'"
RsQuery.ActiveConnection = Dbhrd
RsQuery.CursorLocation = adUseClient
RsQuery.LockType = adLockPessimistic
RsQuery.CursorType = adOpenKeyset
RsQuery.Open
End Sub
'THANK YOU
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|