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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare two strings!?

Status
Not open for further replies.

kruxty

Programmer
Jul 17, 2001
197
PT
I want to compare two strings. One is inserted in a text field and the other is given by the access database.These strings should be compared by letter.

[example]
I insert "tek" on the text field, but i've "tek-tips" on the Database. In the end the page should return to me all the fields that have tek on the name!
[/example]

I'm really a newbie on this stuff, so i don't know the syntax for most of the things. I think that i've to use two arrays. Am i wrong?

If anyone could give me the code for this essay, i'll thanks.

;)
 
I dont know if you want to select it using a sql query or compare in your page, so here are both solutions

SQL Query

SELECT * FROM myTable WHERE SearhField LIKE '%tek%'

Or onm your page

If instr(myString, "tek") > 0 then
'Text exists
end if
 
Well on way would to be to compare the value of your text field in a like statement.
Code:
Select * from table_name,
where field_name like 'field_value'

This is off the top of my head and may need some tweaking.
Of course if you do this and have a large database you will suffer a performance loss
 
search = request("textfield")
SQL="SELECT field from db where field like '%"&search&"%'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top