Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! Upon error, set focus to specified control

Status
Not open for further replies.

mikehoot

Technical User
Oct 18, 2001
97
I am using the following code in a forms On_Error event.

I works fine but I would like to set focus back to a specified control upon this error.

Can anyone help me with this as I am not sure where to place the extra code needed.

Thanks :-9


Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3022 Then
MsgBox "The Label Code you entered is already in use. Please select another code."
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If
End Sub
 
chuck in the following line where you want to give the control focus:

Me.ControlName.SetFocus

that should do it!

wah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top