ValidationRule query

E

Ebeneezer

In Access 2000 (Table Design View)I am trying to write a
Validation Rule so that only the letters A,C,G and T are
accepted not only as ACGT but in any combination and
up to say 10 sequences (40 letters) e.g -
CGATGTACCAGT etc etc.- so far without success. Can it be
done ? Any help appreciated
 
J

John Vinson

In Access 2000 (Table Design View)I am trying to write a
Validation Rule so that only the letters A,C,G and T are
accepted not only as ACGT but in any combination and
up to say 10 sequences (40 letters) e.g -
CGATGTACCAGT etc etc.- so far without success. Can it be
done ? Any help appreciated

DNA sequences, eh?

That's tough to do with a validation rule. For fixed length strings,
e.g. a triplet, you could use

LIKE [ACGT][ACGT][ACGT]

but that falls over when you have variable length strings. You may
need to leave off the validation rule on the Table and do your
validation in VBA code in the Form where these values are being
entered, unless someone else has a bright idea!
 
J

John Nurick

I haven't tested this thoroughly but it ought to work:

Validation rule for field F:
Is Null Or Not Like "*[!ACGT]*"

Validation rule for table:
(Len([F])<=40) And ((Len([F]) Mod 4)=0)

Or in a form I'd use my regular expression validation function
(http://www.mvps.org/access/modules/mdl0063.htm) with a pattern
something like
[ACGT]{,10}



In Access 2000 (Table Design View)I am trying to write a
Validation Rule so that only the letters A,C,G and T are
accepted not only as ACGT but in any combination and
up to say 10 sequences (40 letters) e.g -
CGATGTACCAGT etc etc.- so far without success. Can it be
done ? Any help appreciated

DNA sequences, eh?

That's tough to do with a validation rule. For fixed length strings,
e.g. a triplet, you could use

LIKE [ACGT][ACGT][ACGT]

but that falls over when you have variable length strings. You may
need to leave off the validation rule on the Table and do your
validation in VBA code in the Form where these values are being
entered, unless someone else has a bright idea!

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 

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