Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34

    Access validation rules to ensure accurate data entry

    I have input boxes in access form. I want to limit entry of * in one of the input fields named "Name" anyway If * is found anywhere in anyform of data entry then it should show warning.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The best place to do input validation is the BeforeUpdate event of a control.

  3. #3
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    I am novice !

  4. #4
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    I am not able to do it.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do you have *any* experience with VB or VBA?

  6. #6
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    Very little !!!

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As with most things in Access, there are several way to do this depending on what you actually want to happen. Do you want to warn the user but let them enter the "*" anyway?

  8. #8
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    On Design > conditions >
    Macro named: abc
    Condition : [Name]="*"
    Action: Msgbox

    Message: * can not be entered.

    But if I enter * after any text, symbol etc it didn't show up the warning. I want something more perfect as in my first post requirement.

  9. #9
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    I want to warn the user but let them do not enter the "*" anyway.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by sroy View Post
    I want to warn the user but let them do not enter the "*" anyway.
    "let them do not enter the "*" anyway"...you lost me.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    * has special meaning in Access, it may be interfering with your efforts.
    You may, guessing, be able to use something like [*]????

  12. #12
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    RG: I want to warn the user when they enter the "*" anyway. The warning should appear if any number of time the user tries to enter * anyway.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do you want the user to *have* to respond to the warning by pressing a button or something?

  14. #14
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    I think responding to the warning by pressing a button is better RG.

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try something like this in your control:
    Code:
    Private Sub YourControlName_BeforeUpdate(Cancel As Integer)
       If InStr(Me.YourControlName, "*") Then
          MsgBox "You are using and asterisk '*'", vbCritical + vbOKOnly
       End If
    End Sub
    ...replacing YourControlName with your control name of course.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Validation Rules Help
    By Troop in forum Access
    Replies: 11
    Last Post: 03-05-2013, 01:26 PM
  2. Using Validation rules to restrict certain types of data entry.
    By Long Tom Coffin in forum Database Design
    Replies: 3
    Last Post: 07-23-2012, 10:38 AM
  3. Field rules/validation rules
    By sk88 in forum Access
    Replies: 14
    Last Post: 02-26-2012, 01:03 PM
  4. Textbox data validation rules.....
    By smorelandii in forum Access
    Replies: 1
    Last Post: 02-01-2011, 09:52 PM
  5. Validation Rules
    By esglover in forum Database Design
    Replies: 1
    Last Post: 07-23-2010, 08:02 PM

Tags for this Thread

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