Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memo field and like function

Status
Not open for further replies.

shanmugham

Programmer
Jun 19, 2001
71
IN
Dear Friends,

i am new in vb

i am using vb6 and access 97

access db contains the fields

Gcno - numeric
Title - memo
resn - memo

i want to search the title consisting the word "Basic"

how to search
i used the command
searchtext = "asic" ' that is part word of basic
searchtext = Trim(searchtext)
ssql = "select * from MAIN where TITLE Like " & "'*" & searchtext & "'"
rs.Open ssql, con, adOpenKeyset, adLockOptimistic
MsgBox rs.RecordCount

it gives only Zero records

how i overcome this

pl. help

thanks in advance
shan

 
I would do two things. First change your wildcard character to '%'. This is the one that needs to be used from VB. Second place a second wild card charater after the search string. The way you have it you are only looking for the search string at the beginning of the text you are searching. Try this,


ssql = "select * from MAIN where TITLE Like '%" & searchtext & "%'"

Thanks and Good Luck!

zemp
 
zemp - I thought it was access that recognised the wildcard character and not VB6?

If it is access then you will still have to use the * character but as zemp points out you will need the end wildcard otherwise records will only be picked up if the memo fields ends in 'Title'. i.e.
Code:
ssql = "select * from  MAIN where TITLE Like '*" & searchtext & "*'"


----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
ca8msm, I am not sure what recognizes the wildcard, VB, ADO or Access. What I said was that from VB you need to use the '%' wildcard character.

Within Access I have always used '*', but from VB to access, via ADO, I use '%'.

shanmugham, try them both let us know which one works.


Thanks and Good Luck!

zemp
 
shanmugham
It must be nearly time to stop playing the 'new in vb' card - you've been posting questions to this forum for 2 years now!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
thanks

ssql = "select * from MAIN where TITLE Like '*" & searchtext & "*'"
above statement not working

below statement working fine


ssql = "select * from MAIN where TITLE Like '%" & searchtext & "%'"


thanks

Dear johnwm (Programmer), now also i am new in vb, i am not familier in vb, (vb is a ocean)

thanks all

shanmugham



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top