mtagliaferri
Registered User.
- Local time
- Today, 20:11
- Joined
- Jul 16, 2006
- Messages
- 538
The "Not In List" event code opens a form to add the record, however when I close the form the staff number is not added to the main form opened, and by typing the staff number again it will run the "Not In List" event again.
How can I retain the staff number originally typed and display the record details on the form once the "Not In List" event/form has been closed?
Currently once I have added the staff number, I am not able to close/save the form as unless I type a well known staff number, then close the form re-open it and edit that record to the new staff number last entered.
How can I retain the staff number originally typed and display the record details on the form once the "Not In List" event/form has been closed?
Currently once I have added the staff number, I am not able to close/save the form as unless I type a well known staff number, then close the form re-open it and edit that record to the new staff number last entered.
Code:
Private Sub Staff_Number_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Staff_Number_NotInList
If MsgBox(" CREW MEMBER NOT IN LIST " & vbCrLf & " Do you want to edit crew list? ", vbYesNo) = vbYes Then
Response = acDataErrContinue
Me.Staff_Number.Undo
DoCmd.OpenForm "frmCrewMember", , , , acFormAdd
Forms!frmCrewMember.StaffNumber = NewData
Else
Response = acDataErrContinue
Me.Staff_Number.Undo
End If
Exit_Staff_Number_NotInList:
Exit Sub
Err_Staff_Number_NotInList:
MsgBox Err.Description, , " db1"
Resume Exit_Staff_Number_NotInList
End Sub