How to search for a field useing - "Select...LIKE"

rozolins

New member
Local time
Today, 06:15
Joined
Mar 30, 2009
Messages
4
hello everybody :)

please help, when i connect to my access DB from VB i whant to search it for a specific entry in a specific field and i need the programme to show me all the fields for that specific entry i am searching

1)fldadrese is the field where i will write in the letters or words i want the programme to find
2)obj is the filed in which i am searching
3)kadastrala_uzmerisana is the table where i need to search

here is the code
----------------------
Dim S As String

If fldadrese <> "" Then
If Len(S) > 1 Then S = S & " AND "
S = S & " obj Like ""* & (fldadrese.Text) & * """
End If
If Len(S) > 1 Then
S = "Select * From kadastrala_uzmerisana where " + S
Else
S = ""
End If

LoadFlex S
-------------------------------
it seems there is a problem whit the LIKE part, because VB cant find anything in access from this cind of syntax
 
S = S & " obj LIKE '*" & fldadrese. Text & "*'". You placed the wildcard outside the string expression
 
Last edited:
Thanks for the replay
but it seems to me that this chould be the correct syntax for using Ms SQL, i am using Ms ACCESS, and it still doesnt work properlly. some how the programme cant find any records in the data base
 
actually i just found out, kinda stupid mistake i hade here, when using ACCESS the wildcard is % insted of *

soo, the correct syntax is S = S & "obj Like '%" & fldadrese.Text & "%'"

just posted it so maybe it helps some one else :)
 

Users who are viewing this thread

Back
Top Bottom