Selecting parts of a field for querie

  • Thread starter Thread starter wstut
  • Start date Start date
including or excluding ".com"?
eg, do you want
http://apps5.oingo.com
or
http://apps5.oingo

What about sites that have a different ending, eg
http://www.access-programmers.co.uk

You can use the InStr function to find the location of one string within another, and then use Left function to select everything left of that point.

InStr([start, ]string1, string2[, compare])

Left(string, length)

I'll assume you want the whole site name, including .com (or .uk or whatever). I'd suggest searching for the "/" after the site name, so you'll need to start searching after the http:// which is 7 characters, so start at 8
You don't want the "/" included in the result, so you want 1 character less than the location of the "/"
eg:

SubUrl: Left(url, InStr(8, url, "/") -1 )

will create a calculated field called SubUrl. You can then group/sort by this field.
 
Last edited:
Thanks a lot Adeptus. Worked fine.

Wouter
 

Users who are viewing this thread

Back
Top Bottom