Results 1 to 7 of 7

Thread: Validation rule

  1. #1
    Join Date
    Mar 2013
    Posts
    29

    Unanswered: Validation rule

    Field shouldn't get sign like "| \ / : * ? " < > "
    e.g. John/

    I try to write many event combination like:
    not ("?","<",">",":","*","/","\","|")
    <> "?" Or "<" Or ">" Or ":" or "*" Or "/" Or "\" Or "|"
    but it doesn't work :/

    Please help me guys!
    Last edited by andrzejfox; 04-02-13 at 04:41.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if your validation rules are that complex then you may be better off pushing the validation into the control that captures the data, and place the validations in the controls after update event

    I don't like the idea of doing that as a general rule as it measn crap data can be entered into the tables as the validation is only done at form level

    Microsoft Access tips: Validation Rules
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2013
    Posts
    29
    My users using only MS runtime so it's sufficient to protect only form level.
    But I can't find on this link rules for my exaple.
    e.g. Tried to use:
    Is Null Or Not Like "/"
    When I enter:
    / - it works
    but when I enter:
    xyz/ - Doesn't work:/
    Last edited by andrzejfox; 04-02-13 at 07:48.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    place some VBA code in the controls after update event

    there's two ways of handling it

    either
    reject the input
    OR
    correct it

    say you wanted only alphanumeric + " "
    iterate through each character int he controls text/value property and remove any non required character

    use instr or the ASC function to resolve what characters are in the control

    as an alternative do you knwo preciely waht range of characters ARE valid for your control
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2013
    Posts
    29
    Ok, I understand to put vba in the controls after update event.
    This code should reject the input.
    say you wanted only alphanumeric + " "
    yes

    I'm beginner so it's too hard for me create code by myself
    Could You show, how should my code look?

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if all you want is alpha numeric then oine of the simple column validation rules shoud work

    eg:- Is Null Or Not Like "*[!a-z OR "" ""]*"

    short of knowing what it is you actually want to rule in OR out its hard to move this further forward

    for now forget about the actual implementation and build a clear rules set identifying what IS valid (or conversely if its easier what isn't valid)
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Mar 2013
    Posts
    29
    Sorry for misleading but it can't be alphanumeric because in my language are some special letters:/

    This field should have the same rule what You need to create folder in Windows, because I use content of this field for it.

    So the content can't have character like this "| \ / : * ? " < > "

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •