Text String Manipulation

L

Les

Newfld:Left([yourfield], InStr([yourfield], ".") -1)
-----Original Message-----
I have part numbers like this 11A800.7632 or AMG7002488.A544

I am looking for an Access function that would KEEP
everything to the left of the decimal point.
 
K

Kirk P.

Your function works perfectly for those product numbers that have decimals in the string, however it looks like I have some product numbers that DO NOT have decimals. Such as

Produc
5461C00047.1IB
777777

In the case of 77777777, I get #Error returned as a value in the query. Any additional advice


----- Les wrote: ----

Newfld:Left([yourfield], InStr([yourfield], ".") -1
 
J

John Spencer (MVP)

You can force a decimal point at the end by concatenating it to the original
string. This may still give you errors if your field is a null.

NewFld: Left([yourfield], InStr([yourfield] & ".", ".") -1)

Or you can use an IIF statement

NewFld: IIF(Instr([yourField] & "",".")>1, Left([yourfield], InStr([yourfield] &
".", ".") -1),[YourField])
Your function works perfectly for those product numbers that have decimals in the string, however it looks like I have some product numbers that DO NOT have decimals. Such as:

Product
5461C00047.1IBA
7777777

In the case of 77777777, I get #Error returned as a value in the query. Any additional advice?


----- Les wrote: -----

Newfld:Left([yourfield], InStr([yourfield], ".") -1)
-----Original Message-----
I have part numbers like this 11A800.7632 or AMG7002488.A544
.
 
K

Kirk P.

Perfect - thanks for the help!!!


----- John Spencer (MVP) wrote: ----

You can force a decimal point at the end by concatenating it to the origina
string. This may still give you errors if your field is a null

NewFld: Left([yourfield], InStr([yourfield] & ".", ".") -1

Or you can use an IIF statemen

NewFld: IIF(Instr([yourField] & "",".")>1, Left([yourfield], InStr([yourfield]
".", ".") -1),[YourField]

Kirk P. wrote
Your function works perfectly for those product numbers that have decimals in the string, however it looks like I have some product numbers that DO NOT have decimals. Such as
Produc 5461C00047.1IB
777777
In the case of 77777777, I get #Error returned as a value in the query. Any additional advice
----- Les wrote: ----
Newfld:Left([yourfield], InStr([yourfield], ".") -1
-----Original Message----
I have part numbers like this 11A800.7632 o AMG7002488.A54
I am looking for an Access function that would KEE everything to the left of the decimal point
Any ideas
 
Top