
Set Focus back on field (Access 2000 form)
You cannot set the focus to a control while the focus is in the process
of leaving that same control.
Try adding a hidden control of any type on the form. Add code to its
GetFocus event to return the focus to the 'DocQuant' control. Change
your existing code in the 'DocQuant' control to send the focus to the
new control.
What you'll get is:
on leaving DocQuant, the focus is passed to the new control
on entering the new control, the focus is passed to DocQuant.
HTH,
--
National Library of Canada
-- Nothing in the above should be construed to represent
anything other than my own opinions and personal reality. --
Quote:
> Hello,
> I hope my problem is addressed correctly in this newsgroup.
> Form_Reclaims subform - 1
> Option Compare Database
> Private Sub DocQuant_LostFocus ()
> If DocQuant <=0 Then
> MsgBox ("Please enter a valid document quantity")
> DocQuant.SetFocus
> End If
> End Sub
> What I would like: Set the focus back to field "DocQuant", but the
above
> code doesn't do that. Although DocQuant.SetFocus, focus moves into the
next
> field. I want the focus to be remain on the DocQuant field, unless a
value
> >0 has been inserted.
> Thank you for your help
> Pasquale Imbemba