Problem with setFocus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following is a code snippet:

If txtAmount > txtOrigAmt Then
MsgBox ("You may not pay more than the obligation amount.")
txtAmount.Value = txtOrigAmt.Value
txtAmount.SetFocus
Else . . .
End If

When the code executes, the cursor goes to the next field (tab order)
instead of the txtAmount field. How can I fix this?

Thanks
 
Where is this code?

you most likely execute this code before the focus moves to the next field
(before update) so the code is executed (including setting the focus) then
Access moves to the next field.

Replace your setfocus command or add a line right after it like...

Cancel = True


Please note: If you had searched, this same question was answered at least
once in the last week or two.

Rick B
 
Back
Top