*like* statement problem 
Author Message
 *like* statement problem

Hi
This query only pulls out data from table if its an exact match to field
data, or it creates an error.
I need to get the *LIKE* working so it pulls out data where only part of the
field data is entered in the search box ; ie if value in field = bloggs then
the *Like* would only need *oggs* or *blog* and the upper/lower case would
not matter.
cant get the wildcard % to work here either.

This is my code:-

oRs.Open "SELECT * FROM member WHERE member.company_name Like('" & strCoName
& "')"

can you help?
Thanks



Sat, 08 Feb 2003 03:00:00 GMT  
 *like* statement problem
Try:

oRs.Open "SELECT * FROM member WHERE Instr( 1, member.company_name, '" &
strCoName & "') > 0"


Quote:
> Hi
> This query only pulls out data from table if its an exact match to field
> data, or it creates an error.
> I need to get the *LIKE* working so it pulls out data where only part of
the
> field data is entered in the search box ; ie if value in field = bloggs
then
> the *Like* would only need *oggs* or *blog* and the upper/lower case would
> not matter.
> cant get the wildcard % to work here either.

> This is my code:-

> oRs.Open "SELECT * FROM member WHERE member.company_name Like('" &
strCoName
> & "')"

> can you help?
> Thanks




Sat, 08 Feb 2003 03:00:00 GMT  
 *like* statement problem
I managed to solve the problem shortly after posting it goes...
oRs.Open "SELECT * FROM member WHERE member.company_name Like ('%" &
strCoName & "%')"
Thanks for help.

My next issue is to display all matching records and not just the first
found as shown in this instance.
My intentions are to import the matching *company_Name* records into a
dropdown.
any ideas?
Thor

Quote:
> Try:

> oRs.Open "SELECT * FROM member WHERE Instr( 1, member.company_name, '" &
> strCoName & "') > 0"



> > Hi
> > This query only pulls out data from table if its an exact match to field
> > data, or it creates an error.
> > I need to get the *LIKE* working so it pulls out data where only part of
> the
> > field data is entered in the search box ; ie if value in field = bloggs
> then
> > the *Like* would only need *oggs* or *blog* and the upper/lower case
would
> > not matter.
> > cant get the wildcard % to work here either.

> > This is my code:-

> > oRs.Open "SELECT * FROM member WHERE member.company_name Like('" &
> strCoName
> > & "')"

> > can you help?
> > Thanks




Sun, 09 Feb 2003 03:00:00 GMT  
 *like* statement problem
Quote:
>>My next issue is to display all matching records and not just the first

found as shown in this instance.
My intentions are to import the matching *company_Name* records into a
dropdown.<<

You will need to iterate through your recordset, adding a line per record,
maybe something like this (where rs is your recordset):

Do Until rs.eof
  Response.Write "<option value=""" & rs("Field") & """>" & _
                 rs("Field") & "</option>" & vbcrlf
  rs.movenext
Loop    

Hope this helps.

Steve.



Mon, 10 Feb 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. for statement problem with aspupload

2. Conditional Statement Problem

3. *like* statement problem

4. Apostrophe problem in a recordset.find statement

5. using class statement problem

6. If statement in select case problem

7. Problem with the Continue statement

8. Problem with SQL statement

9. Problem with Update statement

10. If Then Statement problems

11. database SELECT statement problem

12. Insert Into statement problem.

 

 
Powered by phpBB® Forum Software