Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
| Search | Today's Posts | Mark Forums Read
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
 
Old September 30th, 2005, 07:30 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


 
Old October 3rd, 2005, 02:49 PM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madda
Default

try putting single quotes around the percentages like below

<%IF(RecordSet.Fields("fieldname") LIKE '%PA%' )Then%>

 
Old October 4th, 2005, 12:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old July 7th, 2007, 09:22 PM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old February 1st, 2010, 08:02 PM
Authorized User
 
Join Date: Jan 2010
Location: Whitsundays Australia
Posts: 36
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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
 
Old February 2nd, 2010, 07:00 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!




Similar Threads
Thread Thread Starter Forum Replies Last Post
if/else statement mussa Beginning PHP 5 July 3rd, 2006 06:06 PM
What does the @ do in the following statement? kenn_rosie VB.NET 2002/2003 Basics 1 March 15th, 2006 12:20 PM
Like Statement Nitin_sharma Oracle ASP 2 May 10th, 2005 12:18 AM
Like Statement Nitin_sharma Oracle 4 February 12th, 2005 01:46 PM
Like statement Nitin_sharma Classic ASP Databases 7 February 1st, 2005 11:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.