I keep getting
run-time eooro '2108'
You must save the field before you execute the gotocontrol action, the gotocontrol method, or the setfocus method.
How do I fulfill this requirement and still force the user to re-enter the data??
Thanks
John Fuhrman
run-time eooro '2108'
You must save the field before you execute the gotocontrol action, the gotocontrol method, or the setfocus method.
How do I fulfill this requirement and still force the user to re-enter the data??
Code:
Select Case Len(Me.FileNumber)
Case Is < 7
Dim strResult As String
strResult = MsgBox("Not a Valid File Number", 0 + 48 + 65536, "ERROR")
Select Case strResult
Case vbOK, vbRetry, vbYes, vbNo
MsgBox "Please Correct the File Number", 0 + 48 + 65536, "ERROR"
DoCmd.Save acDefault
DoCmd.GoToRecord , "frmTrackingTable", acNewRec
Me.FileNumber.SetFocus
Exit Sub
Case vbCancel, vbAbort, vbIgnore
Exit Sub
Case Else
Exit Sub
End Select
Case 8 To 13
If left(Me.FileNumber, 3) Like "[a-zA-Z][a-zA-Z][a-zA-Z]" Then
strResult = MsgBox("Not a Valid File Number", 0 + 48 + 65536, "ERROR")
Select Case strResult
Case vbOK, vbRetry, vbYes, vbNo
MsgBox "Please Correct the File Number", 0 + 48 + 65536, "ERROR"
Me.FileNumber.SetFocus
Exit Sub
Case vbCancel, vbAbort, vbIgnore
Exit Sub
Case Else
Exit Sub
End Select
ElseIf left(Me.FileNumber, 1) Like "[a-zA-Z]" Then
strResult = MsgBox("Not a Valid Reciept Number", 0 + 48 + 65536, "ERROR")
Select Case strResult
Case vbOK, vbRetry, vbYes, vbNo
MsgBox "Please Correct the Reciept Number", 0 + 48 + 65536, "ERROR"
Me.FileNumber.SetFocus
Exit Sub
Case vbCancel, vbAbort, vbIgnore
Exit Sub
Case Else
Exit Sub
End Select
End If
Case Is > 13
strResult = MsgBox("Not a Valid File Number", 0 + 48 + 65536, "ERROR")
Select Case strResult
Case vbOK, vbRetry, vbYes, vbNo
MsgBox "Please Correct the File Number", 0 + 48 + 65536, "ERROR"
Me.FileNumber.DefaultValue = ""
DoCmd.Save acDefault,
DoCmd.GoToRecord , , acPrevious
Me.FileNumber.SetFocus
Exit Sub
Case vbCancel, vbAbort, vbIgnore
Exit Sub
Case Else
Exit Sub
End Select
Case Else
'Good File Number
End Select
Thanks
John Fuhrman