View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wpiet wpiet is offline
external usenet poster
 
Posts: 23
Default Position to UserForm TextBox from OK_Click MsgBox

in a UserForm with 2 textboxes (UsrID & Psw) & 2 command buttons (OK &
Cancel), my sub OK_Click is as follows:

Private Sub OK_Click()
If Me.UsrID = Empty Then
MsgBox ("You Must Enter A User Name")
Else
If Me.Psw = Empty Then
MsgBox ("You Must Enter A Password")
Else
Module1.UsrID = Me.UsrID.Value
Module1.Psw = Me.Psw.Value
Unload Me
End If
End If
End Sub

If either If condition is true, how can I position back to the offending
textbox for re-entry?
Also, for Cancel, I would like to abort the calling module after verifying
the user's intention of cancelling. Any ideas on this?
Thanks.
--
Will