Re: more help with programming!
- From: "George Nicholson" <GeorgeNJunk@xxxxxxxxxxx>
- Date: Tue, 11 Sep 2007 15:57:09 -0500
The Mid function will extract the specified # of characters from a string,
starting at the specified position. The value it returns is a String.
Mid(String, StartPosition, #ofCharacters)
Mid("200600016004",3,2) = "06"
Mid("200600016004",5,5) = "00016" (Val() then turns the string into a
number, thereby stripping the leading zeros)
Mid("200600016004",10,3) = "004" (again, Val() strips the leading zeros.
all this boils down to:
"06" & "-" & 16 & "-" & 4
Which should equal "06-16-4". You say you get "06-16-04". I don't know why
you get "04".
HTH,
"JudyT" <JudyT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A6A6933C-2F8C-4C83-86B9-6B99A6EC7C51@xxxxxxxxxxxxxxxx
Hey John,
Okay, it returns this as text 06-16-04. As I said, not sure how it is
pulling out the fields for this end result. Can you help me?
"John W. Vinson" wrote:
On Tue, 11 Sep 2007 11:16:01 -0700, JudyT
<JudyT@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
okay. what the engineer did is this
took a long number and converted it into a brief number but not sure
exactly
what is going on with this code. The original number is this
200600016004.
When I count from left to right, the (2) being number 1 position the (0)
being the second position, it just doesn't sort out correctly. Can you
clear
things up for me.
Brief1: (Mid([WorkLog]![COMMITMENT#],3,2)) & "-" &
Val(Mid([WorkLog]![COMMITMENT#],5,5)) & "-" &
Val(Mid([WorkLog]![COMMITMENT#],10,3))
I would expect this expression to return 06-00016-004. Is that a) not
what you
get? or b) not what you expect? What DO you expect, and what do you get?
Is the datathpe of the field Text or is it Number? It should be Text.
John W. Vinson [MVP]
.
- Follow-Ups:
- Re: more help with programming!
- From: JudyT
- Re: more help with programming!
- References:
- Re: more help with programming!
- From: John W . Vinson
- Re: more help with programming!
- Prev by Date: Re: more help with programming!
- Next by Date: Re: Why Re-Link causes Corruption
- Previous by thread: Re: more help with programming!
- Next by thread: Re: more help with programming!
- Index(es):
Relevant Pages
|