Problem with SetFocus()

Problem with SetFocus()

Post by Tom Wrigh » Fri, 07 Nov 1997 04:00:00



Hi,
I'm having a problem that I hope is a simple problem to solve.
I have a grid with several columns:  Item#(txtItem),
Description(txtDesc), Lot Qty(txtLotQty), Total Qty(txtTotalQty),
and price(txtPrice).

Here is what appears to be happening:

<focus is in item#>
{ I type in an item#}
txtItem.Valid()                      executes
txtItem.LostFocus()                  executes
   This.parent.txtLotQty.SetFocus()  command issued
txtLotQty.When()

txtItem.Valid()                      executes
txtLotQty.GotFocus(              )   executes
     :
     :
     :

The odd part is that after the LostFocus() event issued the command
to set focus, it executes the item#'s Valid event again.  I know
this because within the valid event, a messagebox appears.  It
appears a second time before finally setting focus to the LotQty field.

Or, does the valid() event simply fire twice????

I guess through all this, I can clearly state that my objective is
to do the following:

1) type an item#
2) validate it and as needed, set focus to a field within the grid
   that is not the next field following item#

ANY HELP WOULD BE GREATLY APPRECIATED.  I've struggled with this
cursor control too long.

Tom