update (remove last 4 characters)

  • Thread starter Thread starter _Bigred
  • Start date Start date
B

_Bigred

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
 
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.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
sorry to sound foolish ... do I put the InstrREV where Len is? and then
remove the -4?

Thanks Allen,
_Bigred



Allen Browne said:
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.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
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
 
Assuming all entries have a dot before the last character:

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
sorry to sound foolish ... do I put the InstrREV where Len is? and then
remove the -4?

Thanks Allen,
_Bigred



Allen Browne said:
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.

message
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.
 
Thanks Allen that worked like a charm!

Thanks much,
_Bigred



Allen Browne said:
Assuming all entries have a dot before the last character:

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
sorry to sound foolish ... do I put the InstrREV where Len is? and then
remove the -4?

Thanks Allen,
_Bigred



Allen Browne said:
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.

message
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top