Mark-

To restrict the values in a field to just A or B, use:

In("A", "B")

Force upper case with an Input Mask:

>L

To restrict a value in a field based on what's in another field, you must
define a Table level validation rule.  Open your table in Design view and
then open the Properties window.  In the Table validation rule, you can
enter expression such as:

=IIF([Field1]=1, [Field2]="A", IIF([Field1]=2, [Field2]="B", False))

If Field1 contains a 1, then Field2 must contain the letter A.  I Field1
contains a 2, then Field2 must contain the letter B.  If Field1 isn't a 1 or
2, then the validation fails.

John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of ME
Sent: Wednesday, February 01, 2006 10:53 AM
To: [email protected]
Subject: [ms_access] validation rule for text box

Text Box properties-
validation rule-
I want to restrict values to uppercase letters from
A-B inclusive in TextBox1
I want to restrict values in another Text Box,
TextBox2, depending on the letter 
entered in TextBox1

I tried using the Expression Builder to come up with
the following rule for 

TextBox1:

=[txt]>="A" And [txt]<="B"

but everything I enter, A, B, Z, a, b, etc. fails the
validation test. I can't get to the second test until
I get the first to work. I tried setting the
validation rule in both the form and the table but
neither worked. Can someone please help?

Thanks,
Mark Espinosa


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to