I seem to have so much trouble with set focus. Does it trouble anyone else?
Maybe I dont understand what it does or maybe its the if /then I am using. I
have a very simple pop up form. it has 2 enties and I want to be sure that
there is data in those fields before I close the form.
If it detects a null, want it to stop and wait for input at the txtbox. It
doesn't, it just closes form. My guess is the if/then not the set focus but
I hope I will get other opinions.
Private Sub cmdToClosefrmRepairComplete_Click()
On Error GoTo Err_cmdToClosefrmRepairComplete_Click
If IsNull(txtDateRepairComplete) Then
MsgBox (" You must have an Entry in 'Date Repair Complete'")
Me.txtDateRepairComplete.SetFocus
End If
DoCmd.Close
Exit_cmdToClosefrmRepairComplete_Click:
Exit Sub
Err_cmdToClosefrmRepairComplete_Click:
MsgBox Err.Description
Resume Exit_cmdToClosefrmRepairComplete_Click
End Sub
I

Signature
Thanks for any assistance
Ken Snell [MVP] - 29 Mar 2005 23:17 GMT
Put an Exit Sub step right after the SetFocus step. Your code currently sets
the focus and then continues to the Close step.
If IsNull(txtDateRepairComplete) Then
MsgBox (" You must have an Entry in 'Date Repair Complete'")
Me.txtDateRepairComplete.SetFocus
Exit Sub
End If

Signature
Ken Snell
<MS ACCESS MVP>
>I seem to have so much trouble with set focus. Does it trouble anyone
>else?
[quoted text clipped - 28 lines]
>
> I
NNlogistics - 30 Mar 2005 00:35 GMT
Thanks Ken
> Put an Exit Sub step right after the SetFocus step. Your code currently sets
> the focus and then continues to the Close step.
[quoted text clipped - 36 lines]
> >
> > I