J
JHSJ
Guest
I want to set the focus to the top control of the next record if the user clicks OK to the following message box:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Check to determine if the user knows the date is outside the range 1999-2001
Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte
If Arrival_Dt < #1/1/99# Or Arrival_Dt > #12/31/01# Or IsNull(Arrival_Dt) Then
strMessage = "Year should be 1999, 2000 or 2001 for Arrival Date." & _
Chr(13) & "Save anyway?"
intOptions = vbQuestion + vbOKCancel
bytChoice = MsgBox(strMessage, intOptions)
If bytChoice = vbCancel Then
Arrival_Dt.SetFocus
Cancel = True
End If
End If
End Sub
When I click the move next record control and get the message box above, and then click OK, the focus goes to the Arrival_Dt control instead of the first field of the next record. I think it would be more intuitve for the user if the focus were set to the top of the next record instead of the Arrival_Dt, which is in the middle. Please help.
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Check to determine if the user knows the date is outside the range 1999-2001
Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte
If Arrival_Dt < #1/1/99# Or Arrival_Dt > #12/31/01# Or IsNull(Arrival_Dt) Then
strMessage = "Year should be 1999, 2000 or 2001 for Arrival Date." & _
Chr(13) & "Save anyway?"
intOptions = vbQuestion + vbOKCancel
bytChoice = MsgBox(strMessage, intOptions)
If bytChoice = vbCancel Then
Arrival_Dt.SetFocus
Cancel = True
End If
End If
End Sub
When I click the move next record control and get the message box above, and then click OK, the focus goes to the Arrival_Dt control instead of the first field of the next record. I think it would be more intuitve for the user if the focus were set to the top of the next record instead of the Arrival_Dt, which is in the middle. Please help.