Results 1 to 5 of 5
  1. #1
    galkej is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    3

    Form Validation Rule

    Hello,



    I have a form in which there are fields that have validation rules for the quantity and types of characters that are entered by the people on the production floor. The operators are wanting me to refine this so that if they accidentally enter or scan the wrong information, the affected field will automatically be cleared of the previously-entered contents (after they clear the validation error pop-up window). How can I accomplish this?

    Thanks

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Where/how are these Validations being done; using the Validation Properties at the Table or Form level or through VBA code in the Form?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    galkej is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    3
    Just in the Validation Properties, i.e. Like "????????????" to ensure that they scan the barcode with the 12 characters, and not the adjacent one that has 10 characters.

    I need all other fields on the form to remain static after the error event; I only want the info incorrectly entered in the offending field (I'll call this field "Serial Number") to automatically be deleted after acknowledging the validation pop-up window. Someone recommended the code below, but this clears out ALL of the fields on my form. I only want the serial number field to auto-clear itself after the validation error.

    Private Sub Command17_Click()
    If Me.Dirty Then
    Me.Undo
    End If
    End Sub

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    See what this does:
    Code:
    Private Sub Command17_Click()
    
    If Me.Dirty Then
       Me.[Serial Number].Undo
    End If
    
    End Sub
    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    galkej is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    3
    Thanks for the reply. I tried your recommendation, but unfortunately nothing happens after I clear the validation pop-up window with the modified code.

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

Similar Threads

  1. Validation Rule in Table vs. Form
    By LanieB in forum Forms
    Replies: 2
    Last Post: 03-12-2012, 03:27 PM
  2. Record Submit Validation Rule in Form
    By agent- in forum Programming
    Replies: 7
    Last Post: 05-24-2011, 04:03 PM
  3. Help with validation rule
    By Desstro in forum Programming
    Replies: 5
    Last Post: 02-27-2011, 08:05 PM
  4. Validation Rule Form AfterUpdate
    By GraemeG in forum Programming
    Replies: 6
    Last Post: 02-09-2011, 10:22 AM
  5. Validation Rule
    By smitstev in forum Access
    Replies: 5
    Last Post: 06-30-2009, 09:58 AM

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