Select Case and exit button/submit button validity analysis
Option Compare Database
'Programmed by Oruc Kenan Yildirim
'Start date Friday 27 January 2006
'http://outsideuniverse71.tripod.com
'-------------------------------------
Function testcheckin() As Integer
'disabling exit button if data is already entered
'This will force the user to hit the submit button or
'using escape button to clear the form
'--------------------Doc ID--------------------
'............................................................................
'///////////// Defining variables /////////////
'............................................................................
'-3-Verify if exit command can be applied here
'-31-define variables
Dim verifyobject As String, msgnullobject As Integer, quitnoentry As
String, FilledAllSubmit As Integer
'-32-verifyobject is : if any of the value is left empty
verifyobject = IsNull(txtSessionID) Or IsNull(FrameMajotminorEffect) Or
IsNull(frameEffectlongevity) Or IsNull(FrameAmelioratecomp) Or
IsNull(FrameActualjob) Or IsNull(FramePojMgrSign) Or IsNull(frameClientsignature)
Or IsNull(FrameApprovedstamp)
'-33-quitnoentry is : if all the value are entered or none
of them are entered
quitnoentry = IsNull(txtSessionID) And IsNull(FrameMajotminorEffect) And
IsNull(frameEffectlongevity) And IsNull(FrameAmelioratecomp) And
IsNull(FrameActualjob) And IsNull(FramePojMgrSign) And
IsNull(frameClientsignature) And IsNull(FrameApprovedstamp)
'-34-Check if operator started data entry
Select Case verifyobject
'-341-data opereator has made incomplete data entry
'..........................................................................................
'///////////// data operator has made no entry in any of the textbox
/////////////
'///////////// quit permission granted /////////////
'..........................................................................................
Case Is = True
Select Case quitnoentry
'-3411-all fields are left empty
Case Is = True
msgnullobject = MsgBox("are you sure to quit", vbYesNo, "No data entered")
Select Case msgnullobject
'-34111-data operator wish to quit the document-and
permission granted
Case vbYes
DoCmd.Close
'-34112-data operator doesn`t want to quit
Case vbNo
msgnullobject = MsgBox("Quit operation cancelled by user", vbOKOnly, "COntinue
your entry")
End Select
'-3412data entry has started entry but it is incomplete
'............................................................................
'///////////// data operator made some entry /////////////
'///////////// some text box are left blank /////////////
'............................................................................
Case Is = False
msgnullobject = MsgBox("Cannot quit: Data entry not finished", vbOKOnly,
"Error")
End Select
'-342-data operator has entered all
'but wish to quit without submitting document
'............................................................................
'///////////// data operator has filled all the document /////////////
'///////////// but wish to quit- /////////////
'///////////// two options: return back or submit /////////////
'............................................................................
Case Is = False
FilledAllSubmit = MsgBox("You have filled all fields, Would you like to submit
the document now?", vbYesNo, "Important")
Select Case FilledAllSubmit
Case vbYes
'-13214-open the form "FileTransfer"
DoCmd.OpenForm "frm040VersionControl"
'-13215-Document check in hiding
Forms!frm001DocumentCheckIn.Visible = False
Case vbNo
'do nothing
End Select
End Select
'End of forcing the user
End Function