validation rule in query?

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
 
J

J_Goddard via AccessMonster.com

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
 
J

John W. Vinson

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]
 
G

Guest

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

Linda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top