 |
| Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 30th, 2005, 07:30 PM
|
|
Registered User
|
|
Join Date: Sep 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Using LIKE with an if statement
I have a field in an Access2000 DB that I would like to query using LIKE
<%IF(RecordSet.Fields("fieldname") LIKE %PA% )Then%>
This throws error messages all over the place, mostly Sub or Function not defined
Can anyone tell me how to do this correctly??
TIA
|
|

October 3rd, 2005, 02:49 PM
|
|
Authorized User
|
|
Join Date: Sep 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
try putting single quotes around the percentages like below
<%IF(RecordSet.Fields("fieldname") LIKE '%PA%' )Then%>
|
|

October 4th, 2005, 12:11 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Or given that you shouldn't be using SQL at this point, becuause you're querying the recordset not the database, perhaps this would be better:
Code:
<% If InStr(RecordSet.Fields("fieldname"), "PA")>0 Then %>
I am a loud man with a very large hat. This means I am in charge
|
|

July 7th, 2007, 09:22 PM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Do you know how to pull many item using "LIKE"
Below is the example but got error
Dim sSqlMaster, sSqlLike
sSqlMaster = ""SELECT DISTINCT TOP 65535 T1.A,T1.B " & _
"FROM Table1 " & _
"WHERE T1.A "
For i = 0 to i =count step 1
sSqlLike = sSqlLike & "LIKE '" & part[i]& "%' AND T1.A "
Next
sSqlMaster = sSqlMaster & Left(sSqlLike, (Len(sSqlLike) - 1
apple
|
|

February 1st, 2010, 08:02 PM
|
|
Authorized User
|
|
Join Date: Jan 2010
Posts: 36
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
MS Access Recordset Problem
Hi,
I am developing a site with ASPVisualBasic, Dreamweaver MX and MS Access Database. I have a login page that opens from a relational database users.mdb with 2 tables Client/Company. I enter user and password and that takes me to another page my products and services page. This has links to a number of my services. The one I am having a problem with is upload debtors.
Having already login in when I click upload debtors a new form opens and the details of the client who loged in should populate the form from the 2 tables Client/Company.
I have 2 Recordsets (Recordset1) for the Company table and (rsclient) for the Client table.
The populating data from the (rsclient) inserts into the form ok changing to suite the different client login's and displaying their matching data correctly.
(The Problem) is the populating data from the (Recordset1) that should display things like Company Name, Trading name and so on, will not change the details based on the user who logs in. No matter what login/(matches the ID row) I use it will only display the first row in the table Company, when I deleted the first row of data it displayed the 2nd row of data not matching the ID row and it's connecting login details.
(Recordset1) SQL looks like this-
SELECT *
FROM Company
WHERE CompanyID like 'qrycompanyid'
Variables look like this -
NAME DEFAULT VALUE RUN-TIME VALUE
qrycompanyid % Request.QueryString("ClientCompanyID")
(rsclient) SQL looks like this- and remember this works
SELECT *
FROM clients
WHERE UsrName like 'MM_Username'
Variables look like this-
NAME DEFAULT VALUE RUN-TIME VALUE
MM_Username % Session("MM_Username")
Can anybody out there get me out of trouble with above?
Cheers
Leonard P.O'Grady
Whitsundays
Australia
|
|

February 2nd, 2010, 07:00 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Cross post. Please see here for any replies: MS Access SQL Problem
Please don't cross post; it makes things only more difficult to track and manage....
Imar
|
|
 |