[AccessD] Focus On Currrent Control After Update

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Sat Feb 25 13:55:39 CST 2006


Dear List:

I have the following module:

Private Sub fldContainerCheck1_AfterUpdate()
    If CheckTheCheck(fldContainerCheck1) = False Then
        fldContainerCheck1 = ""
        Me(Screen.ActiveControl.Name).SetFocus
    End If
   
End Sub

if the function CheckTheCheck returns fasle then I want to set the focus 
back on the field fldContainerCheck1.

If I write Me(Screen.ActiveControl.Name).SetFocus or 
Me.fldContainerCheck1.SetFocus the focus ends up on the next control in 
tab order.

If I write Me(Screen.PreviousControl.Name).SetFocus the focus ends up on 
the previous control in tab order.

How can I get the focus back on the field that has the problem?

I tried     If CheckTheCheck(fldContainerCheck1) = False Then 
Me.fldContainerCheck1.Undo

in both before and after update events but it didn't undo the entry.  I 
don't want to undo the entire record at this point, just blank the field 
with the bad number and set the focus there.

MTIA

Rocky


SetFocus

-- 
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com




More information about the AccessD mailing list