Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

update (remove last 4 characters)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
_Bigred - 23 Mar 2006 08:22 GMT
I setup my update query trying to remove the last 4 of a FileName

I tried

LEFT([Powertabs],4) but this left only the first 4 letters of the file name.

I tried RIGHT([Powertabs]),4 but this gave me .ptb

Ultimately the file names would be as such

Green Day - American Idiot.ptb
Bon Jovi - Livin On A Prayer.ptb

I would like to be able to run a update query and remove the .ptb from the
file names.

TIA,
_Bigred
Allen Browne - 23 Mar 2006 08:29 GMT
Try:
   Left([Powertabs], Len([Powertabs]) - 4)

If the extensions could more more than 3 characters (e.g. mypage.html or
mypic.jpeg), you might want to use InstrRev() to locate the position of the
last dot in the file name.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I setup my update query trying to remove the last 4 of a FileName
>
[quoted text clipped - 15 lines]
> TIA,
> _Bigred
_Bigred - 23 Mar 2006 09:12 GMT
sorry to sound foolish ... do I put the InstrREV where Len is? and then
remove the -4?

Thanks Allen,
_Bigred

> Try:
>    Left([Powertabs], Len([Powertabs]) - 4)
[quoted text clipped - 22 lines]
>> TIA,
>> _Bigred
Allen Browne - 23 Mar 2006 12:17 GMT
Assuming all entries have a dot before the last character:

   Left([Powertabs], InstrRev([Powertabs], ".") - 1)

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> sorry to sound foolish ... do I put the InstrREV where Len is? and then
> remove the -4?
[quoted text clipped - 25 lines]
>>> I would like to be able to run a update query and remove the .ptb from
>>> the file names.
_Bigred - 23 Mar 2006 23:21 GMT
Thanks Allen that worked like a charm!

Thanks much,
_Bigred

> Assuming all entries have a dot before the last character:
>
[quoted text clipped - 29 lines]
>>>> I would like to be able to run a update query and remove the .ptb from
>>>> the file names.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.