+ Reply to Thread
Results 1 to 3 of 3

TextBox Validation - won't cancel

  1. #1
    Registered User
    Join Date
    06-20-2016
    Location
    Hawaii
    MS-Off Ver
    2010, 2015, 365
    Posts
    8

    TextBox Validation - won't cancel

    I am a novice with VBA code. My current challenge is getting data validation to work how I'd like. Here's my problem...
    • I am trying to validate entries in a TextBox to be sure the user enters a numeric value
    • I've place my validation code in the BeforeUpdate event handler
    • The code catches the error as planned.
    • The problem I'm having is that I cannot exit the form to abort entry OR clear all fields to start over without the validation running without end.

    This is a sample of my code:

    Please Login or Register  to view this content.
    • If the user enters a numeric value, the validation stops
    • If a user leaves the TextBox empty and tries to close or reset the form fields, the message box keeps popping up and the validation loops until the form is "X"d out. Then it runs two more times before the form closes.

    Having the validation loop if the user would like to continue to the other fields in the form and complete the input is okay. The problem is is the user decides that they would like to exit the form and abort the entry. The validation won't stop.

    I have other TextBoxes on the form that have the same issue. I believe they all have the same problem

    I will appreciate any assistance to identify the code I'm missing to allow a user to abort the entry and close the form.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: TextBox Validation - won't cancel

    Hi, I can go and explain all the ideas, but try and take a look here.
    https://stackoverflow.com/questions/...-including-and
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,960

    Re: TextBox Validation - won't cancel

    Untested, but you probably need to change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Userform textbox validation - non-existent date validation
    By rbngrt582 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2018, 10:14 PM
  2. [SOLVED] i need to cancel data validation across a large workbook
    By Trebor777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-14-2017, 08:13 AM
  3. Replies: 2
    Last Post: 11-28-2014, 07:09 AM
  4. Add Cancel argument to Textbox Exit event
    By Idahoanne in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-08-2014, 12:13 AM
  5. Replies: 5
    Last Post: 11-18-2010, 05:37 PM
  6. Cancel Validation and Change Event
    By cholley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2006, 08:10 PM
  7. [SOLVED] Cancel Macro is user selects 'cancel' at save menu
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2005, 01:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1