Trim first and last characters

rletarte

New member
Local time
Yesterday, 17:40
Joined
May 10, 2012
Messages
1
Hello all!

I am trying to trim the first 5 characters and the last character in my field.

I currently have the following code and it does not seem to work. Any ideas?

Trim(Mid$([cust]![altnum],6,Len([cust]![altnum])-1))

In the field the data is USDA: 10a as an example. I am trying to have it only display 10 as the answer. The code above still displays the a for some reason.
 
The Mid() function is:

Mid(String, Start, Length)

Not:

Mid(String, Start, Stop)

From Acces help:

Number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.

So if x= "USDA: 10a" -> 9 characters then:

Trim(Mid(x,6,Len(x)-6)) -> Lenght = Len(x) -> 9 - 6 -> 3 characters lenght and trim the space at the end.

Hope this helps

JR
 

Users who are viewing this thread

Back
Top Bottom