validation rule in query?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a validation rule in the table to specifically enter one of 8 state
abbreviations. ="IA" Or " IL" Or "IN" Or " MI" Or "MN" Or "MO" Or "OH" Or
"WI"

The Validation text that appears if not followed is Not a valid R3 State
Abbreviation

I have built several queries based on this table and have a parameter query
for State that says Enter State Abbreviation. However, if one mis-types the
state, the validation text doesn't appear.

Is there something special I need to do??

Thanks,

Linda
 
Hi -

The validation rule and and validation text are applied when data is entered
into the table, but not when a select query is run.

Unfortunately, there is not a lot you can do to validate parameters to a
query - all that will happen in this case is you get no results.

You would be best off designing a form to validate the user request and then
filter and display the data.

HTH

John
 
I have a validation rule in the table to specifically enter one of 8 state
abbreviations. ="IA" Or " IL" Or "IN" Or " MI" Or "MN" Or "MO" Or "OH" Or
"WI"

The Validation text that appears if not followed is Not a valid R3 State
Abbreviation

I have built several queries based on this table and have a parameter query
for State that says Enter State Abbreviation. However, if one mis-types the
state, the validation text doesn't appear.

Is there something special I need to do??

Validation applies to data actually being written to a table - not to criteria
parameter values.

I'd suggest using a small unbound Form, frmCrit let's call it, with a Combo
Box cboState contining these state names. The parameter should be

=Forms!frmCrit!cboState

This will let the user pick a valid state code, rather than making them type
one in and slapping their hand if they do it wrong.

John W. Vinson [MVP]
 
Thanks, John! I will try this. I'm getting burnt out with building this
database, so I am overlooking the obvious.

Linda
 
Back
Top