Well, I figured I'd end up with this as a question. I wanted to insure that if a clerk selected a command button on a form that opens a 2nd Form and then decides "Oops, I didn't want to do that" That the Cancel command button would VOID the transactions that were INSERT INTO the db when selecting the first Form's Command Button. (Just FYI - when they select a command button on the first form it inserts a Set number of new records into the Db)
When the 2nd form opens it only shows the x number of new records that form1 created. There the user is supposed to input info for each of the new records created. If they choose to cancel I have to have those transactions voided due to what is going to happen elsewhere in the program.
The VBYesNo function I set up to cancel doesn't work it keeps going to the Else portion regardless of whether the user selects yes or no.....
Private Sub cmdCancel_Click()
Dim z As Integer
z = 1
If MsgBox("You selected CANCEL. This will delete the current information. Are you sure you want to Cancel the input of this information?", vbYesNo, "CANCEL INFORMATION!") = vbOK Then
CurrentDb.Execute "Update ShiftReportingLVL set Voided=Yes" _
& " WHERE RptgSeqID=" & Me.txtMaxSeqID & " And LVLPositionNbr =" & z, dbFailOnError
z = z + 1
If z = Val(Me.txtLocationNbrMachines) + 1 Then Exit Do
MsgBox "This LVL Reporting information has been voided. If you still need to record an LVL Reporting you must re-execute the LVL Reporting Main Menu!", vbOKOnly, "NOTICE! LVL REPORTING VOIDED!"
MsgBox "You chose to Exit the Cancel function." & vbNewLine & vbNewLine & "Please review the information input. If your input is complete you must choose either:" & vbNewLine & _
"i)Save & Close OR ii)Cancel", vbOKOnly, "EXIT THE CANCEL LVL REPORTING PROCEDURE!"
Any help on what I have out of order or syntaxed incorrectly?