+ Reply to Thread
Results 1 to 4 of 4

set focus

  1. #1
    Forum Contributor
    Join Date
    05-04-2005
    Posts
    136

    set focus

    I have a form with a txt box named txtAuditor. on the exit event, i have some validation checks.
    i want that if the validation fails, the focus will go back to that txt box.

    i currectly have

    if variable=false then
    txtauditor.value=""
    txtauditor.setfocus
    endif

    this did not work!
    Any suggestions??

  2. #2
    Dave O
    Guest

    Re: set focus

    Sure looks like it should work. One debugging strategy is to put a
    Msgbox statement inside your "if variable=false then" / end if
    statement. That way you can deliberately cause your validation to fail
    and when you get the message box you know your logic is sound.

    > if variable=false then

    msgbox ("About to set focus to txt.auditor")
    > txtauditor.value=""
    > txtauditor.setfocus
    > endif



  3. #3
    Forum Contributor
    Join Date
    05-04-2005
    Posts
    136
    it does enter the procedure- it also resets the text box

    I think what is happening is that it is still letting the user exit the txtbox so it sets the focus, but then the user exited. i set cancel to true and then is worked

  4. #4
    Dave O
    Guest

    Re: set focus

    ....Or, now that I hearken back to my Access programming days, try this:

    if variable=false then
    me.txtauditor.value=""
    me.txtauditor.setfocus
    endif


+ 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