T
Tony Williams
I have a form with a subform. In the on error property of the sub form I
have this code
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim strMsg As String
Dim TitleStr As String
If DataErr = 3058 Then
Response = acDataErrContinue ' Don't display the default message
TitleStr = " No Quarter End Month!"
strMsg = "You can not enter a record without " _
& "completing the Qtr End Month" & vbCrLf & vbCrLf _
& "Do You Wish To Go Back " _
& "And Enter The Qtr End Month?"
If MsgBox(strMsg, vbYesNo, TitleStr) = vbYes Then
Forms!frmFDA!txtMonthlabela.SetFocus
Cancel = True
Else: Me.Undo
DoCmd.Close , frmFDA
End If
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If
End Sub
What I want to happen is if the answer to the question is YES I want the
focus to be set on the control txtmonthlabela on the main form. When I click
on YES I get Error 2110 Access can't move the focus to txtmonthlabela. Can
anyone help?
Thanks
Tony
have this code
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim strMsg As String
Dim TitleStr As String
If DataErr = 3058 Then
Response = acDataErrContinue ' Don't display the default message
TitleStr = " No Quarter End Month!"
strMsg = "You can not enter a record without " _
& "completing the Qtr End Month" & vbCrLf & vbCrLf _
& "Do You Wish To Go Back " _
& "And Enter The Qtr End Month?"
If MsgBox(strMsg, vbYesNo, TitleStr) = vbYes Then
Forms!frmFDA!txtMonthlabela.SetFocus
Cancel = True
Else: Me.Undo
DoCmd.Close , frmFDA
End If
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If
End Sub
What I want to happen is if the answer to the question is YES I want the
focus to be set on the control txtmonthlabela on the main form. When I click
on YES I get Error 2110 Access can't move the focus to txtmonthlabela. Can
anyone help?
Thanks
Tony