473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Help required on Access SQL queries

Hi - a bit new to access. I'm looking for help on if Access can do
the following:

I have an access database on which I run a SQL query which I export as
an excel spreadsheet for sending to a client.

One field in a record contains an image pathname e.g.
/images/folder1/imagename.jpg

Is there anyway in the SQL query that I can remove the pathname and
just leave the filename e.g.
imagename.jpg?

Another field contains an html page name without the domain name
information.e.g.
test.html

Is there anyway in the SQL query that I can prefix the pagename with
the domain name information e.g.
http://www.domainname.com/test.html

TIA
Nov 12 '05 #1
4 2003
You can use functions in your queries. So, you can write a function that
returns the "last" token out of a set of delimited values. Just place the
following function in a standard module.

Public Function sGetLastF(vText As Variant) As String

Dim vBuf As Variant

If IsNull(vText) = False Then
vBuf = Split(vText, "/")
sGetLastF = vBuf(UBound(vBuf, 1))
End If

End Function

Now, in your query builder, just type in

MyFileName:sGetLastF([YouPathNameField])
For the url one, you can just make another expression in the query builder
like:

FullURL:("http://www.domainname.com/" + ([YourURLField]))
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn

Nov 12 '05 #2

Hi Guys - thanks for your replies.

If I could trouble you for one more thing.

The image files mentioned earlier are in different directories with
different levels. e.g.

/images/folder1/imagename.jpg
/images/folder2/imagename.jpg
/images/imagename.jpg

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
I don't understand your question here.

The fact of different directories does not change the fact that you want to
return just the file name. What does one have to do with the other.

The function I posted will always return the file name, regardless of how
many folders deep you have.

Perhaps your problem is stated wrong. Did you need something more then a
function that returns the file name?
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 12 '05 #4
Hi Albert - youre absolutely right - I'm being a bit of a dickhead
here.

I checked the records and found that the seperator used in the record
pathname is a backward slash (\) and not a forward slash (/).

I've changed this in your function and it now works fine.

Again thanks a lot for your help

Regards
DAvid


On Mon, 27 Oct 2003 17:29:35 GMT, "Albert D. Kallal"
<NO************@msn.com> wrote:
I don't understand your question here.

The fact of different directories does not change the fact that you want to
return just the file name. What does one have to do with the other.

The function I posted will always return the file name, regardless of how
many folders deep you have.

Perhaps your problem is stated wrong. Did you need something more then a
function that returns the file name?


Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff Blee | last post by:
I am hoping someone can help me. I am making a Access 97 app for a person and have run up against a problem to do with MS Graph. There is a table that has a number of data elements and a date field...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
2
by: AAVF IT | last post by:
Hi I am developing an application in MS Access 2000 that is to bolt on to an existing Access database, that links via ODBC to our UNIX-based factory management system. I need some help in this...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
1
by: Simon Matthews | last post by:
Hope someone can help an Access beginner! I've just started keeping my surgical logbook on access and it's a simple flat-file affair. I have created several queries that will list cases...
1
by: mithril | last post by:
I cannot get my head around this query... I think I need a nested query but here's the problem. I promise i've exerted my meager brain power on this problem & ask this as a last resot! 3...
1
by: loosecannon_1 | last post by:
Hello everyone, I am hoping someone can help me with this problem. I will say up front that I am not a SQL Server DBA, I am a developer. I have an application that sends about 25 simultaneous...
32
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset ...
3
by: Grayscale | last post by:
Hello, When I execute the code below, I get: "Microsoft JET Database Engine (0x80040E10) No value given for one or more required parameters." error message in the first line. Rs.Open...
2
by: Bob Alston | last post by:
Anyone know of any list of changes required in an Access FE to make the Access FE work with a SQL backend? ditto for Access FE working with a MYSQL backend? Bob
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.