+ Reply to Thread
Results 1 to 3 of 3

textbox focus events

  1. #1
    Registered User
    Join Date
    07-11-2014
    Location
    North Carolina
    MS-Off Ver
    2010
    Posts
    30

    textbox focus events

    Hey guys have a quick question.
    I'm attempting to have some data validation done when the focus is set on a text box.
    Short version is: when the user inputs there data in two previous textboxes a "BeforUpdate" event runs to update a third text box. The third textbox tabstop is set to false. In the forth textbox before the user is able to enter in data i need it to validate the data in the third textbox is useable data. useable data is the easy part anything >0. if the data in the third textbox is <0, null, or "" then i need it to reset the data in the first two textboxes and set the courser to the first textbox.
    I'm looking for something like this but not sure how to set up the declarations to make it work.

    'user has tabed out of second textbox into the "forth" text box;
    'in the forth text box the validation would look like this (in some way)
    If Me.DelayTimeBox.Value >= 0 Then Exit Sub
    If Me.DelayTimeBox.Value = { <=0, or Null, or ""} Then
    Set Me.DispatchBox.{Text or Value unsure which to use} = ""
    Set Me.EnRouteBox.{Text or Value unsure which to use} = ""
    Me.DispatchBox.SetFocus
    End If

    I've tried inputting that in some form or another in every place I can think of but it either causes the "BeforeUpates" to not work or i get nothing at all. I'll input what i have to make it (i hope) simpler to follow what I'm attempting to do.
    I keep thinking it would go on a textbox focus event of some type but not sure where to start.
    Here is what I have so far:
    Please Login or Register  to view this content.
    The Pirvate Sub Dispatch and EnRoute_Change() is in there to validate that a time of <= 2359 is entered if not than it kicks it out and makes you fix it. That works unless the user inputs a value of say 1199. Its in that case the "BeforeUpdate" is unable to do its math and leaves the DelayTimeBox empty. Its for those cases I need this second level of validation in the forth textbox. I know I said a quick question but it ended up being a little more involved than I thought. Any help or point in the right direction is greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: textbox focus events

    Sorry you are going down a blind alley.

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: textbox focus events

    Duplicate Deleted.

+ 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. textbox without focus
    By eugz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2014, 04:24 PM
  2. Focus on Textbox
    By seemanthv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2014, 02:38 AM
  3. [SOLVED] Textbox focus
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-08-2013, 12:25 AM
  4. Textbox loses focus?
    By mike0123m in forum Excel General
    Replies: 1
    Last Post: 02-28-2012, 06:44 PM
  5. How to tell what textbox got the focus
    By vqthomf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2005, 09:15 AM

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