By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,298 Members | 1,434 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,298 IT Pros & Developers. It's quick & easy.

Problem with left(text,#) function!

P: 78
I keep seeing that if the "text" part of
Expand|Select|Wrap|Line Numbers
  1.  left(text, #) 
is "" or zero, that it will return "text", which is what it is doing in my situation.

These are phone numbers that I'm trying to pull the area codes from.

It's actually starting to return the first 3 characters on the left, until it see's a "0" and then it returns the entire number ("text").

It works fine as long as the area code does not contain a "0".

I have this field set as a text field but apparently that isn't good enough.

Does anyone know how to code it so that it will see a "0" as it would any letter, or other number?

Thanks!
Apr 7 '10 #1

✓ answered by missinglinq

To be honest, I'm totally confused as to what you're trying to do with

format([Phone Number],.

and your problem was not with

left(text, #)

as you said, but rather with

Format(Text,Left(Text,3))

At any rate, this works regardless of whether or not the Area Code has a zero in it

AreaCode: Left([Phone Number],3)

Linq ;0)>

Share this Question
Share on Google+
4 Replies


TheSmileyCoder
Expert Mod 100+
P: 2,321
Are you using this from within code, or directly in a query?
Apr 7 '10 #2

P: 78
Directly in a query:

Expand|Select|Wrap|Line Numbers
  1. AreaCode: format([Phone Number], left([Phone Number], 3))
Where "Phone Number" is a phone number. The field is a text field and I have an input mask to force the number n the following format:

1234567890

The problem is that if the first three (area code) contain a "0", it will pull the numbers up to the "0" then copy the entire number after that.

Here's an example:

The number 9896664454 returns 989

The number 9906665445 returns 999906665445 (gets up to the 0, then gets the entire number).

Thanks
Apr 7 '10 #3

missinglinq
Expert 2.5K+
P: 3,532
To be honest, I'm totally confused as to what you're trying to do with

format([Phone Number],.

and your problem was not with

left(text, #)

as you said, but rather with

Format(Text,Left(Text,3))

At any rate, this works regardless of whether or not the Area Code has a zero in it

AreaCode: Left([Phone Number],3)

Linq ;0)>
Apr 7 '10 #4

P: 78
Wow, do I feel like a HUGE idiot! I guess I was over doing it, as usual! I had picked up one too many things at once and was trying them together!

Thanks Missinglinq! I appreciate the help very much!
Apr 8 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.