Function LEFT (1 Viewer)

Sniperbooya

Registered User.
Local time
Today, 14:11
Joined
Jan 30, 2015
Messages
16
Good Morning everyone,

I have got a question regarding Access' function: LEFT()

I have got a record in the query named 'KernelNumber'.

Kernelnumber
01A
01B
02A
02B
03A
03B

What i would like to do is split the '01' from the 'A' and the 'B'

Luckily i remembered there was a function called LEFT() which allows you to do so:

Code:
test : Left([Kernelnumber],2)

which works just fine.

BUT, only if kernelnumber <= 99A.

I was wondering if it was possible to say: Take everything to the left of "A" and "B" without specifically stating the number of characters?

So that it wont be a problem if there is a kernelnumber of 101A..
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 22:11
Joined
Jan 20, 2009
Messages
12,856
If the part you want on the left is always numeric you could use:

Val([Kernel Number])

However it does cause problems if the letter is N or E and is followed by more digits as this would be interpreted as exponential notation.
 

Sniperbooya

Registered User.
Local time
Today, 14:11
Joined
Jan 30, 2015
Messages
16
Thanks, ill give it a shot.

Only the letters A and B will be used so that wouldnt be a problem.

Thanks again.
 

MSAccessRookie

AWF VIP
Local time
Today, 08:11
Joined
May 2, 2008
Messages
3,428
Other Functions worthy of consideration are

Right(YourString, 1) will get the last character

Left(Len(YourString) - 1) will get all but the last character

-- Rookie
 

Users who are viewing this thread

Top Bottom