update (remove last 4 characters)

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
 
A

Allen Browne

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

_Bigred

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
 
A

Allen Browne

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

_Bigred

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