Avatar of Wayne Barron
Wayne BarronFlag for United States of America asked on

ASP Classic and access database - get value between / Forward Slash

Hello, All.
(ASP Classic / Access Database)

OK, I am working on a project for our family home use.
In this project, I am using an Access Database.
(This makes it easier if I port it over to someone else's computer if they would like to use it.)

The column (CASTID) has the following
4807/11056/11055/11054/11053/2011/11052/11051/11050/10897/11049/

Open in new window


OK, let's say you only wanted to return the value for
2011
How would you ask that in Access, that will work in ASP Classic?

I asked a similar question over here.
However, it is for SQL Server.

I tried the code from netminder, and I am uncertain about how to get it to work with my current project.

Wayne
ASPMicrosoft Access

Avatar of undefined
Last Comment
Wayne Barron

8/22/2022 - Mon
John Tsioumpris

What exactly you want to return...all i see is a row of numbers separated by slashes...
EDIT: Well i took a look at your other question ...if you want something similar in Access here is a way to do it :
Sub SplitBetweenSlashes()
Dim b() As String
Dim s As String
s = "4807/11056/11055/11054/11053/2011/11052/11051/11050/10897/11049/"
b = Split(s, "/")
'Now the b Array holds all the values as array entries
End Sub

Open in new window

ASKER
Wayne Barron

Hello, John.
I wrote this.


OK, let's say you only wanted to return the value for
2011

So, in the string, all I would want to return would be that number.

Also, in Classic ASP all I have to do to get the numbers separated is this.

<%
s = split("4807/11056/11055/11054/11053/2011/11052/11051/11050/10897/11049/", "/")
for each x in s
response.Write x & "<br />"
next
%>

Open in new window

John Tsioumpris

Lets take it from the start...when you say "all I would want to return would be" : 2011 how you expect to get this number...
Following the above code
For i =Lbound(b) to Ubound(b)
if b(i) = 2011 Then
'Some code here for finding 2011
End if
Next

Open in new window

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
Wayne Barron

Just a little heads up.
I am using Classic ASP in this project, not. DOT NET.
So, the AS STRING.
For the DIMS, does not need to be added in.

Also, you have lost me on what you are trying to do.
I will look back at this after I get up from some much-needed rest.
John Tsioumpris

I am working on the Access side...in case you want to implement the  "querying" in The BE...if you are after ASP...i am afraid i am not familiar.
ASKER CERTIFIED SOLUTION
Fabrice Lambert

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Gustav Brock

In a query, using a parameter named, say, SearchCastID, you can filter on :

Where 
    (Left([CastID], Len([SearchCastID]) + 1) = [SearchCastID] & "/") Or
    (Right([CastID], Len([SearchCastID]) + 1) = "/" & [SearchCastID]) Or
    (InStr([CastID], "/" & [SearchCastID] & "/") > 0)

Open in new window

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Wayne Barron

@Fabrice
Your code did exactly what I needed it to do.
Thank you.

@John.
I was lost in the code you provided for me. And since you noted it was all on the Access side, that got me lost even more.
As some of the code you were providing, looks similar to that of asp.net.

@Gustav
I tried your code, and it would give me a LOT of different results.
I need it to give me ONE record, whichever record is being searched for, is the record that I need to be returned.


Thank, Fabrice
Wayne