Results 1 to 5 of 5
  1. #1
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97

    troubles with validation rules

    I have two fields in a table where I would like to force users to fill in as follows

    1) Like "1#-####" (i.e. I want : number 1-any number - any number-any number-any number-any number)



    2) Like "A-##:##" (i.e. I want : letter A - any number-any number : any number-any number)

    They don't seem to work to me. What's wrong in my syntax ???
    Thx

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Don't make it a validation rule, make it an input mask, it will prevent anyone from entering data in a format you don't want.

  3. #3
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97
    input mask just suggests what to type in but leaves user able not to fill all placehorders, which is not good to me. I have to validate.
    While now I have managed "Like "1#-####" Or Is Null" to work ok, I can't find a way to maximatize the first letter in the following validation rule

    Like >"A*##:##" Or Like >"A*##" Or Like >"A*###" Or Like >"A*###:##" Or Is Null

    The symbol ">" capitalize letters in an input mask, but it seems not to work in a validation rule... Any idea ? Am I obliged to apply capitalization in vba ?
    Furthermore the * acts as a wildcard for whatever comes after it ? Any way to let it to be read as text instead of as a wildcard ?
    Thx

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    that it doesn't matter if it's lower case or upper case, when you display it you can use the ucase(left(fieldname,1)) function to change it to upper case when you look at it on a query or form etc.

  5. #5
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97
    Quote Originally Posted by rpeare View Post
    that it doesn't matter if it's lower case or upper case, when you display it you can use the ucase(left(fieldname,1)) function to change it to upper case when you look at it on a query or form etc.
    Fixed it. Square parenthesis encased the asterisk ! I use the following as field validation rule in my table....

    Like "A[*]##:##" Or "A[*]##" Or "A[*]###" Or "A[*]###:##" Or Is Null

    and the following in my AfterUpdate control event to capitalize first letter :

    Private Sub control_name_AfterUpdate()
    Me.control_name= UCase(control_name)
    End Sub

    Thanks !

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple Validation Rules
    By Theremin_Ohio in forum Access
    Replies: 1
    Last Post: 12-16-2011, 01:21 PM
  2. Question about Validation Rules
    By WilsonsW in forum Access
    Replies: 1
    Last Post: 04-18-2011, 05:06 PM
  3. Textbox data validation rules.....
    By smorelandii in forum Access
    Replies: 1
    Last Post: 02-01-2011, 09:52 PM
  4. Validation Rules
    By esglover in forum Database Design
    Replies: 1
    Last Post: 07-23-2010, 08:02 PM
  5. Validation rules question
    By cps6568 in forum Access
    Replies: 3
    Last Post: 01-12-2010, 02:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums