extracting LAST x characters of a string

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I am creating a query in Access 2007. One of the fields stores the path to a
Word document. This path can be long and may look like:

G:\Projects\2009\00000-ABC Project\Correspondence\<filename>.doc

My hope is to be able to come up with a query that correctly returns the
<filename>.doc part of the string. Note that with the exception of the
G:\Projects\2009 part of the string, everything else can be variable in
length. Also, sometimes it's a .doc extension and sometimes a .docx
extension.

Can anyone tell me how to write a SQL statement to just extract the
<filename>.doc part?

Thanks!
 
Duane...you are a genius!
Thanks!!


Duane Hookom said:
Try something like:
Mid([One of the fields],Instrrev([One of the fields],"\")+1)
--
Duane Hookom
Microsoft Access MVP


Brian said:
I am creating a query in Access 2007. One of the fields stores the path to a
Word document. This path can be long and may look like:

G:\Projects\2009\00000-ABC Project\Correspondence\<filename>.doc

My hope is to be able to come up with a query that correctly returns the
<filename>.doc part of the string. Note that with the exception of the
G:\Projects\2009 part of the string, everything else can be variable in
length. Also, sometimes it's a .doc extension and sometimes a .docx
extension.

Can anyone tell me how to write a SQL statement to just extract the
<filename>.doc part?

Thanks!
 
Back
Top