I would like a field in my table to have 5 characters. If
the entry have less than 5, a Zero adds to the front of
data.
If enter 345D. It should correct to 0345D.
If entry more than 5 characters, validate text pop-up.
Could someone help me with the "Zero adds to the front of
data"?
Thanks
Ashley
Well, if you're adding it through a macro, here is some sample code (should
work :-))
Dim A as string, B as string
A = "345D"
B = String("0", 5 - Len(A)) + A
B now contains the string you need :-) If it doesn't work...look up how to
use the String function.
Sincerely,
ASP.Confused
> I would like a field in my table to have 5 characters. If
> the entry have less than 5, a Zero adds to the front of
[quoted text clipped - 6 lines]
> Thanks
> Ashley
ASP.Confused - 29 Jul 2004 22:23 GMT
Stupid me....just realized what a "Validation Rule" is...lol. What I gave
you might help you out, but I'm stuck on this question too.
> Well, if you're adding it through a macro, here is some sample code (should
> work :-))
[quoted text clipped - 20 lines]
> > Thanks
> > Ashley
Ernie - 30 Jul 2004 06:33 GMT
try something like:
Me![MyField] = Right("00000" & [input],5)
I'm not certain of the placement of the quotes but it
should be similar to that.
Me![MyField] is where you want to store it
[input] is what the user typed in
HTH
>-----Original Message-----
>Stupid me....just realized what a "Validation Rule" is...lol. What I gave
[quoted text clipped - 28 lines]
>
>.
ASP.Confused - 30 Jul 2004 13:28 GMT
Expanding on Ernie's method, here is this:
Me![MyField] = String$(5 - Len([input], "0") + [input]
> try something like:
>
[quoted text clipped - 49 lines]
> >
> >.
Ashley
Why? Are you more concerned about how it looks, or what character string is
stored? You can set the display format to zero-pad, without altering the
stored string.

Signature
Good luck
Jeff Boyce
<Access MVP