validation rules avoid line brake

  • Thread starter Thread starter davidg
  • Start date Start date
D

davidg

Hello
I would like to avoid line brake in fileds by using validation rules.
All other characters should be valid

How can I do that?
 
Hello Bonnie

Yes I think it might be the CHR(13) or CHR(10).
They get in by copy and pasting.
 
Why not just use the Replace function to remove those characters from the
input before storing the data?
 
if a line brake is entered also the characters after the line brake might be
wrong.
Therefore records with line brake should not be allowed.
 
You could use

Instr([MyField], Chr(13) & Chr(10)) = 0

Would mean the field has no line break.
 
Hello Klatuu

Thanks a lot. I think that might be the way to go but still it works not as
I hope.
with the new validation rule Instr([MyField]; Chr(13) & Chr(10)) = 0

It will not accept an empty field, which was emptied by the user.
(If befor an invalid value was in the file and no the filed has been
emptied, than the rule prevents an empty field.





Klatuu said:
You could use

Instr([MyField], Chr(13) & Chr(10)) = 0

Would mean the field has no line break.

davidg said:
if a line brake is entered also the characters after the line brake might
be
wrong.
Therefore records with line brake should not be allowed.
 
Hello Klatuu

Thanks a lot. I think that might be the way to go but still it works not as
I hope.
with the new validation rule Instr([MyField]; Chr(13) & Chr(10)) = 0

It will not accept an empty field, which was emptied by the user.
(If befor an invalid value was in the file and no the filed has been
emptied, than the rule prevents an empty field.

If you want to exclude newlines in a validation rule, I'd suggest

NOT LIKE "*" & Chr(13) & Chr(10) & "*"
 
Hello John

no luck! Not Like "*" & Chr(13) & Chr(10) & "*" is not working, also when I
use only one of the chr(XX).

When I delete the content of the field I receive the message that I enter a
vaule which does not meet the validation rule.

I also tried to add Not Like "*" & Chr(13) & Chr(10) & "*" or like ""

but even that is not working

Do I have to change other properties of the field?
 
Hello John

no luck! Not Like "*" & Chr(13) & Chr(10) & "*" is not working, also when I
use only one of the chr(XX).

When I delete the content of the field I receive the message that I enter a
vaule which does not meet the validation rule.

I also tried to add Not Like "*" & Chr(13) & Chr(10) & "*" or like ""

but even that is not working

Do I have to change other properties of the field?

Sorry! If it's ok for the field to be empty you need a validation rule such as

Not Like "*" & Chr(13) & Chr(10) & "*" OR IS NULL
 
Back
Top