+ Reply to Thread
Results 1 to 5 of 5

setfocus from module to userform control

  1. #1
    Registered User
    Join Date
    09-24-2003
    Posts
    62

    setfocus from module to userform control

    I have a project with many textboxes on different forms. On some of the textbox_exits on some of the forms, I call a standard module that checks what the user has input . If the user needs to change the input, a msgbox appears to inform the user the info needs to be changed.

    I have tried to use ControlSource, Name etc., But I cannot seem to setfocus back onto which ever textbox the input needs to be changed. I think it has something to do wih the _exit event, but not sure.

    Any help would be appreciated.

    This is the code to call the module
    Please Login or Register  to view this content.
    this is part of the standard module code

    Please Login or Register  to view this content.
    Last edited by Zygoid; 01-01-2009 at 10:07 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    The .SetFocus code is working but as soon as the exit routine is exited the focus is returned to the next control.
    You need to set the Cancel argument, if appropriate, in the Exit routine.
    I have changed your subroutine to a function. This allows you to pass back the require action status.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    09-24-2003
    Posts
    62
    Thanks Andy !

    I understand about the Cancel arguement, the function vs sub is what I need to learn more about, and will.

    You solution works great!

  4. #4
    Registered User
    Join Date
    09-09-2004
    Posts
    3
    Please send and help me, create running text for information with vb or vba.
    On you cooperation, thanks.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    Alwi please do not hijack threads.

    Create a new thread, include a link to any relevant posts.
    If your native language is not English I suggest you post in the non-english forum.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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