|
 |
access thread: LIKE not working correctly in Interdev using MS Access
Message #1 by "LeBlanc, Debbie C." <dcleblanc@m...> on Tue, 21 May 2002 10:33:32 -0500
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C200DC.DD352D10
Content-Type: text/plain
I am trying to develop a search page for an employee's phone directory.
I have three options, first name, last name or division.
On doing a search for employees first or last name it is successful.
When I try to do a wildcard search and use the LIKE verb for division, it
does not recognize the request. No value is returned.
I am using visual Interdev with an Access database.
The following is the code I'm using for the search page.
<%
sub button1_onclick
LastName = tblname.value
FirstName = tbfname.value
Division = tbdiv.value
sqltext = "SELECT ID,FNAME,LNAME,MINIT,TITLE,DIV from SAFETY WHERE (LNAME
'" & LastName & "') or (FNAME = '" & FirstName & "') or (DIV LIKE '" &
Division & "%') "
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.moveFirst
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> </TH>
<TH> </TH>
</TR>
<%
cnt = 1
Do while not Recordset1.EOF
cnt = cnt + 1
%>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
Response.Redirect ("searchresults.asp?sqltxt=" & sqltext)
end if
end sub
%>
The following code returns the Query String
__________________________________________________________________
<%
sqltext = Request.QueryString("sqltxt")
Response.Write sqltext
'Response.Write "After sqltext" & sqltext
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.movefirst()
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> 4 </TH>
<TH> 5 </TH>
</TR>
<%
Do while not Recordset1.EOF %>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
%>
Message #2 by Omar Chaudry <OChaudry@b...> on Tue, 21 May 2002 16:44:06 +0100
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C200DE.573E5E00
Content-Type: text/plain
I think you need to use '*' (Asterisk) as the wild card character for Access
not %.
HTH
Omar
-----Original Message-----
From: LeBlanc, Debbie C. [mailto:dcleblanc@m...]
Sent: 21 May 2002 16:34
To: Access
Subject: [access] LIKE not working correctly in Interdev using MS Access
I am trying to develop a search page for an employee's phone directory.
I have three options, first name, last name or division.
On doing a search for employees first or last name it is successful.
When I try to do a wildcard search and use the LIKE verb for division, it
does not recognize the request. No value is returned.
I am using visual Interdev with an Access database.
The following is the code I'm using for the search page.
<%
sub button1_onclick
LastName = tblname.value
FirstName = tbfname.value
Division = tbdiv.value
sqltext = "SELECT ID,FNAME,LNAME,MINIT,TITLE,DIV from SAFETY WHERE (LNAME
'" & LastName & "') or (FNAME = '" & FirstName & "') or (DIV LIKE '" &
Division & "%') "
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.moveFirst
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> </TH>
<TH> </TH>
</TR>
<%
cnt = 1
Do while not Recordset1.EOF
cnt = cnt + 1
%>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
Response.Redirect ("searchresults.asp?sqltxt=" & sqltext)
end if
end sub
%>
The following code returns the Query String
__________________________________________________________________
<%
sqltext = Request.QueryString("sqltxt")
Response.Write sqltext
'Response.Write "After sqltext" & sqltext
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.movefirst()
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> 4 </TH>
<TH> 5 </TH>
</TR>
<%
Do while not Recordset1.EOF %>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
%>
---
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error. Thank you.
Message #3 by "LeBlanc, Debbie C." <dcleblanc@m...> on Wed, 22 May 2002 07:38:39 -0500
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C2018D.99939E00
Content-Type: text/plain
I already tried the * and it still does not work.
Debbie
-----Original Message-----
From: Omar Chaudry [mailto:OChaudry@b...]
Sent: Tuesday, May 21, 2002 10:44 AM
To: Access
Subject: [access] RE: LIKE not working correctly in Interdev using MS Acce
ss
I think you need to use '*' (Asterisk) as the wild card character for Access
not %.
HTH
Omar
-----Original Message-----
From: LeBlanc, Debbie C. [mailto:dcleblanc@m...]
Sent: 21 May 2002 16:34
To: Access
Subject: [access] LIKE not working correctly in Interdev using MS Access
I am trying to develop a search page for an employee's phone directory.
I have three options, first name, last name or division.
On doing a search for employees first or last name it is successful.
When I try to do a wildcard search and use the LIKE verb for division, it
does not recognize the request. No value is returned.
I am using visual Interdev with an Access database.
The following is the code I'm using for the search page.
<%
sub button1_onclick
LastName = tblname.value
FirstName = tbfname.value
Division = tbdiv.value
sqltext = "SELECT ID,FNAME,LNAME,MINIT,TITLE,DIV from SAFETY WHERE (LNAME
'" & LastName & "') or (FNAME = '" & FirstName & "') or (DIV LIKE '" &
Division & "%') "
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.moveFirst
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> </TH>
<TH> </TH>
</TR>
<%
cnt = 1
Do while not Recordset1.EOF
cnt = cnt + 1
%>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
Response.Redirect ("searchresults.asp?sqltxt=" & sqltext)
end if
end sub
%>
The following code returns the Query String
__________________________________________________________________
<%
sqltext = Request.QueryString("sqltxt")
Response.Write sqltext
'Response.Write "After sqltext" & sqltext
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.movefirst()
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> 4 </TH>
<TH> 5 </TH>
</TR>
<%
Do while not Recordset1.EOF %>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
%>
---
---
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error. Thank you.
Message #4 by "Leo Scott" <leoscott@c...> on Wed, 22 May 2002 01:18:38 -0700
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0010_01C2012E.99FBBAD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
LIKE not working correctly in Interdev using MS AccessWhat type of field is Division. Is it a text field?
-----Original Message-----
From: LeBlanc, Debbie C. [mailto:dcleblanc@m...]
Sent: Wednesday, May 22, 2002 5:39 AM
To: Access
Subject: [access] RE: LIKE not working correctly in Interdev using MS Acce ss
I already tried the * and it still does not work.
Debbie
-----Original Message-----
From: Omar Chaudry [mailto:OChaudry@b...]
Sent: Tuesday, May 21, 2002 10:44 AM
To: Access
Subject: [access] RE: LIKE not working correctly in Interdev using MS Acce ss
I think you need to use '*' (Asterisk) as the wild card character for Access not %.
HTH
Omar
-----Original Message-----
From: LeBlanc, Debbie C. [mailto:dcleblanc@m...]
Sent: 21 May 2002 16:34
To: Access
Subject: [access] LIKE not working correctly in Interdev using MS Access
I am trying to develop a search page for an employee's phone directory.
I have three options, first name, last name or division.
On doing a search for employees first or last name it is successful.
When I try to do a wildcard search and use the LIKE verb for division, it does not recognize the request. No value is
returned.
I am using visual Interdev with an Access database.
The following is the code I'm using for the search page.
<%
sub button1_onclick
LastName = tblname.value
FirstName = tbfname.value
Division = tbdiv.value
sqltext = "SELECT ID,FNAME,LNAME,MINIT,TITLE,DIV from SAFETY WHERE (LNAME = '" & LastName & "') or (FNAME = '" &
FirstName & "') or (DIV LIKE '" & Division & "%') "
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.moveFirst
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> </TH>
<TH> </TH>
</TR>
<%
cnt = 1
Do while not Recordset1.EOF
cnt = cnt + 1
%>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %> " >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
Response.Redirect ("searchresults.asp?sqltxt=" & sqltext)
end if
end sub
%>
The following code returns the Query String
__________________________________________________________________
<%
sqltext = Request.QueryString("sqltxt")
Response.Write sqltext
'Response.Write "After sqltext" & sqltext
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.movefirst()
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> 4 </TH>
<TH> 5 </TH>
</TR>
<%
Do while not Recordset1.EOF %>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %> " >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
%>
DISCLAIMER: The information in this message is confidential and may be legally privileged. It is intended solely for
the addressee. Access to this message by anyone else is unauthorised. If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is
prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. Thank
you.
Message #5 by "LeBlanc, Debbie C." <dcleblanc@m...> on Wed, 22 May 2002 10:47:19 -0500
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C201A7.F45DA820
Content-Type: text/plain
YES ,division is a text file.
-----Original Message-----
From: Leo Scott [mailto:leoscott@c...]
Sent: Wednesday, May 22, 2002 3:19 AM
To: Access
Subject: [access] RE: LIKE not working correctly in Interdev using MS Acce
ss
What type of field is Division. Is it a text field?
-----Original Message-----
From: LeBlanc, Debbie C. [mailto:dcleblanc@m...]
Sent: Wednesday, May 22, 2002 5:39 AM
To: Access
Subject: [access] RE: LIKE not working correctly in Interdev using MS Acce
ss
I already tried the * and it still does not work.
Debbie
-----Original Message-----
From: Omar Chaudry [mailto:OChaudry@b...]
Sent: Tuesday, May 21, 2002 10:44 AM
To: Access
Subject: [access] RE: LIKE not working correctly in Interdev using MS Acce
ss
I think you need to use '*' (Asterisk) as the wild card character for Access
not %.
HTH
Omar
-----Original Message-----
From: LeBlanc, Debbie C. [mailto:dcleblanc@m...]
Sent: 21 May 2002 16:34
To: Access
Subject: [access] LIKE not working correctly in Interdev using MS Access
I am trying to develop a search page for an employee's phone directory.
I have three options, first name, last name or division.
On doing a search for employees first or last name it is successful.
When I try to do a wildcard search and use the LIKE verb for division, it
does not recognize the request. No value is returned.
I am using visual Interdev with an Access database.
The following is the code I'm using for the search page.
<%
sub button1_onclick
LastName = tblname.value
FirstName = tbfname.value
Division = tbdiv.value
sqltext = "SELECT ID,FNAME,LNAME,MINIT,TITLE,DIV from SAFETY WHERE (LNAME
'" & LastName & "') or (FNAME = '" & FirstName & "') or (DIV LIKE '" &
Division & "%') "
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.moveFirst
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> </TH>
<TH> </TH>
</TR>
<%
cnt = 1
Do while not Recordset1.EOF
cnt = cnt + 1
%>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
Response.Redirect ("searchresults.asp?sqltxt=" & sqltext)
end if
end sub
%>
The following code returns the Query String
__________________________________________________________________
<%
sqltext = Request.QueryString("sqltxt")
Response.Write sqltext
'Response.Write "After sqltext" & sqltext
Recordset1.setSQLText (sqltext)
Recordset1.open
Recordset1.movefirst()
%>
<Table Border>
<CAPTION> Safety Phone Listing </CAPTION>
<TR>
<TH> ID </TH>
<TH> Full Name </th>
<TH> Division </th>
<TH> 4 </TH>
<TH> 5 </TH>
</TR>
<%
Do while not Recordset1.EOF %>
<TR>
<td>
<%Response.Write (Recordset1.fields.getValue(0)) %>
</td>
<TD>
<A href="coord.asp?AID=<%Response.Write (Recordset1.fields.getValue(0)) %>
" >
<%Response.Write (Recordset1.fields.getValue(1)) %>
<%Response.Write (Recordset1.fields.getValue(2)) %>
</a>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(3)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(4)) %>
</td>
<td>
<%Response.Write (Recordset1.fields.getValue(5)) %>
</td>
<% Recordset1.moveNext()
loop
%>
---
---
---
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error. Thank you.
---
|
|
 |