A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Validation rule



 
 
Thread Tools Display Modes
  #1  
Old July 29th, 2004, 09:57 PM
Ashley
external usenet poster
 
Posts: n/a
Default Validation rule

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
  #2  
Old July 29th, 2004, 10:17 PM
ASP.Confused
external usenet poster
 
Posts: n/a
Default Validation rule

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


"Ashley" wrote in message
...
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



  #3  
Old July 29th, 2004, 10:23 PM
ASP.Confused
external usenet poster
 
Posts: n/a
Default Validation rule

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.


"ASP.Confused" anonymous@ wrote in message
...
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


"Ashley" wrote in message
...
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





  #4  
Old July 30th, 2004, 06:33 AM
Ernie
external usenet poster
 
Posts: n/a
Default Validation rule

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
you might help you out, but I'm stuck on this question

too.


"ASP.Confused" anonymous@ wrote in message
...
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


"Ashley" wrote in

message
...
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





.

  #5  
Old July 30th, 2004, 12:54 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default Validation rule

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.

--
Good luck

Jeff Boyce
Access MVP

  #6  
Old July 30th, 2004, 01:28 PM
ASP.Confused
external usenet poster
 
Posts: n/a
Default Validation rule

Expanding on Ernie's method, here is this:

Me![MyField] = String$(5 - Len([input], "0") + [input]




"Ernie" wrote in message
...
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
you might help you out, but I'm stuck on this question

too.


"ASP.Confused" anonymous@ wrote in message
...
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


"Ashley" wrote in

message
...
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




.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation Rule Shark General Discussion 2 July 28th, 2004 04:39 PM
Validation Rule question Lori Using Forms 1 July 20th, 2004 06:32 PM
HELP!!! Validation rule Chris Using Forms 7 June 1st, 2004 01:11 PM
Validation Rule Tom Database Design 3 May 18th, 2004 10:27 PM
Format cell using Validation rule DDM Worksheet Functions 5 May 3rd, 2004 10:17 PM


All times are GMT +1. The time now is 07:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.