Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    Further testing.
    Expected Size Tolerance +/- lowest possibility outcome
    .555 .01 .545 accepted
    .555 .001 .554 accepted


    .555 .0001 .5549 accepted
    .555 .00001 .55499 accepted
    .455 .0002 .5548 accepted
    .655 .0002 .6548 accepted
    .555 .003 .552 accepted
    .555 .0003 .5547 accepted

  2. #17
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    The spacing of my prior post was thrown off, I apologize

  3. #18
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    This works for me. I entered all required values?
    All fields are Single as advised by @Micron

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Me.ToleranceSize > Me.ActualSize Then
        If Round(Me.ActualSize + Me.TolerancePlus, 4) > Me.ToleranceSize Then
            MsgBox "Out of tolerance"
        End If
    Else
        If Round(Me.ActualSize - Me.ToleranceMinus, 4) < Me.ToleranceSize Then
            Cancel = True
        End If
    End If
        
    End Sub
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #19
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    When I ran the tests above, I also tested going lower than the least possible value in the range, to make sure that the validation rule is in play. It was, each time.

  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    Might want to give the controls valid names, like I did.
    6 months down the line Textxxxx is got going to mean much.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #21
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    Hello Welshgasman. Thank you for running that test. I'm not sure I can use that kind of a solution in the forms that the validation rules exist on. But it's interesting to learn about. However, even if that process runs fine with the .555 expected size and the .0002 tolerances, why do I not need a round function to get very similar values through the validation form? I know nobody has the answer to that know. But just the fact that this question can be asked, means that something isn't right. And I don't believe the point of failure is with the validation rule. If it was the other numbers wouldn't work. If rounding was a factor, it would affect them too.

  7. #22
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    I was going to do that. But there are so many tables and fields in this database, that even the names I give them would not be of any functional use either.

  8. #23
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    Well if you walk though your code, your should see what you are producing and comparing against? and why it complains one way or the other?
    As CJ_London mentioned, could just be a rounding issue for certain numbers? I just picked 4 as that was the limit you were showing?

    Good luck with it anyway.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #24
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    Thank you. I appreciate your efforts.

  10. #25
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    I just created a test db. One table, with 4 fields. One form with 4 text boxes, connected to the fields. And I set up the same validation rule. Same outcome.

  11. #26
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    Quote Originally Posted by sheckay View Post
    I just created a test db. One table, with 4 fields. One form with 4 text boxes, connected to the fields. And I set up the same validation rule. Same outcome.
    Put a Debug.print into your code with the variables you are using and some comment to see what is what, then review the output.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #27
    sheckay is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2022
    Posts
    85
    Thank you Welshgasman. I've never done that. But I'll google it and see if I can put that in place. Thanks again.

    Quote Originally Posted by Welshgasman View Post
    Put a Debug.print into your code with the variables you are using and some comment to see what is what, then review the output.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-05-2017, 03:31 PM
  2. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  3. Validation Rule
    By rbiggs in forum Forms
    Replies: 4
    Last Post: 08-23-2011, 05:24 PM
  4. Validation Rule
    By robomose in forum Access
    Replies: 1
    Last Post: 09-09-2009, 05:59 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