Help required using queries

  • Thread starter Thread starter skinnybloke
  • Start date Start date
S

skinnybloke

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
 
Hi,
Here is a function that returns the filename from a full path:

Public Function GetFileNameFromFullPath(fullPath As String) As String
GetFileNameFromFullPath = Right(fullPath, Len(fullPath) - InStrRev(fullPath, "\", , vbTextCompare))
End Function

I notice you're using / instead of \. If that's correct, just change it in the function.
Be aware that Access 97 does not have the InStrRev function.

You can use the function in your query to create a calculated field:

Filename: GetFileNameFromFullPath([yourField])

PLace the function in a standard module
 
Back
Top