Normal Topic ThrowFocus not working as I expect. (Read 212 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
ThrowFocus not working as I expect.
Apr 12th, 2012 at 9:23pm
Print Post Print Post  
I'm trying to set up a command button that will check the element EmployeeName to see if it is empty or if the number exists in another database.  If the element is blank or the number doesn't exist, I want to have a message box appear to give direction and then set the cursor in the EmployeeName element.

The programming is below and works through the appearance of the proper message box, however the cursor moves on to the next element rather than returning to the EmployeeName element.  I'm trying to do it via the ThrowFocus command.

Any thoughts on why this isn't working?


var vName as string
var vReturnVal as string
var vName2 as string

If @IsBlank(EmployeeNumber)
     {
           @MsgBox("PLEASE ENTER YOUR EMPLOYEE NUMBER AND THEN PRESS ENTER","","")
           ThrowFocus(EmployeeNumber)
     }      
Else
     {

           vReturnVal = @XLookupSourceList(@Fn, EmployeeNumber, "employee!Empl#", "First Name;Last Name")

           vName=@AccessStringArray(vReturnVal,1)
           vName2=@AccessStringArray(vReturnVal,2)

           FirstName=vName
           LastName=vName2

           Name=firstname+" "+LastName

           ThrowFocus(NameIsCorrect)
     

                 If @IsBlank(Name)
                 {
                       @MsgBox("THAT EMPLOYEE NUMBER IS NOT AVAILABLE.","","PLEASE SEE YOUR SUPERVISOR OR HR MANAGER")
                       EmployeeNumber=""
                       ThrowFocus(EmployeeNumber)


                 }
                 Else
                 {
                 Visibility(NameIsCorrect,1)
                 Visibility(NameIsNOTCorrect,1)
                 }
     }

  
Back to top
 
IP Logged