View Full Version : Search by related fields

02-09-2007, 03:32 PM
Dear friends,

Dear friends,

I would need your helpful for the hard task of relationship of diferent fields:

I have 2 tables:



profession first_name last_name
(text) (text) (text)

scientist robert lang
artist edward savoy
artist francisco montes


description (memofield)

Peter Paul was the most popular and prolific British football player of the 19th century.
Robert Lang is an British scientist who is also one of the foremost origami artists and theorists in the world.
Francisco Montes was a visionary artist.
This is a picture of Edward Savoy, who accomplished one of the most signal.


1. The user will input the NICKNAME in an input box. Ok?
2. Normally the asp script would find the NICKNAME in description, HOWEVER I would tie the name of NICKNAME with first_name and last_name. So, the script would need read the name of NICKNAME (input by user), but the script will search the first_name + last_name in DESCRIPTION.

3. The results will shown all records that contains the first_name + last_name in description memofield!

Thank you in advance for your collaboration.


Lebron LETchev

02-11-2007, 09:58 PM
you can use Instr() to look inside a string

apply like this

dim Description, Firstname
Description = rs("description")
FirstName = rs("FirstName")

if instr(Description, Firstname) = 1 then
response.write Description
end if

then do a loop

to check both firstname and lastname try this

dim Description, Firstname, Lastname
Description = rs("description")
FirstName = rs("FirstName")
Lastname = rs("Lastname")

if instr(Description, Firstname) = 1 and instr(Description, Lastname) = 1 then
response.write Description
end if

hope this helps (and works)

02-12-2007, 10:27 AM
Thank you.

This helps me! From brick to brick I will build my wall!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum