Validation

B

BruceM

If you are talking about Access, you could create a table of allowed words,
then make a combo box on the form with its row source set to the table.
Users would have to select a word from the list. Your question is very
general, so if you need more specific information you will need to provide
details.
 
C

Cloud Strife

Actually what I need is in the design view, I want to use the validation rule
to allow characters only and it will come out a message box, if insert
something unrelated.
 
B

BruceM

You can set the validation in the table to Like "[A-Z]", but you will not
receive a useful error message. For that you will need to use a form. In
the After Update event of a text box (txtOne) you could have:

If Not (Me.txtOne Like "[A-Z]") Then
MsgBox "Letters only"
Me.Undo
End If

By default this will not distinguish between upper and lower case letters,
but will allow letters only. You can make it case sensitive, but there is a
little more work.
 
J

John Spencer

Can you be more specific about what you mean?
Do you want only letters allowed (no spaces, no numbers, no punctuation)?

Validation rule:
Not Like "*[!A-Z]*"

which if I didn't screw up will only allow the letter characters to be input
into the control.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
C

Cloud Strife

Validation rule:
Not Like "*[!A-Z]*"

This is working, but I want the rule that can include spaces at least.
 
J

John Spencer

If you want to allow spaces as well as letters then

Not Like "*[! A-Z]*"

Spaces, Letters and Numbers but no punctuation marks or other special characters:

Not Like "*[! 0-9A-Z]*"


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
C

Cloud Strife

Then what validation rule can I use to write currency like only $9.50 is
allowed?

And what validation rule can I use to write percentage only, like 20%?
 
J

John Spencer

I don't know. Are the fields (controls) involved number fields? I
would expect that they are.

What are the limits you want to impose?

Do you want to allow negative numbers? Zero? Blank (null)?
Do you have a range that is allowable?

For instance
Between .001 and 1
would allow you to enter a positive percent between .1 percent and 100
percent, however it would allow things like .090019 to be entered 0
9.0019 percent. IF that is not acceptable then what is the rule.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Top