Another question on my Visitor database, woohoo…
In my Entry form you can issue three different kinds of badges, once you select a badge from the drop down you also set the status of it, for example "Issued" or "Returned". There could be some situations where they will need to delete an entry that was entered in error so I wanted a "Delete" button that would first check the status of the three status fields and if any of the three badges status are set to "issued" I want it to cancel the operation.
Below is the code I’m working with and it works as long as all three fields have a status of "Returned". But on a record where only one of the badges status shows "Returned" it does not delete the record. I am sure that it has something to do with my IF/OR statement but I’m unsure if what I entered is correct or not, since this is the first time I’ve had to use a function like this. Any help would be greatly appreciated.
Code:Private Sub DeleteEntry_Click() On Error GoTo Err_DeleteEntry_Click Dim stDocName Dim stDocName2 Dim stDocName3 Set stDocName = [VEStatus] Set stDocName = [ProStatus] Set stDocName = [ORJ2Status] If MsgBox("You are about to delete an Entry, plase make sure that all 'Issued' badges are marked 'Returned' before continuing. Click 'OK' to confirm deletion or click 'Cancel' to abort.", vbOKCancel + vbCritical, "WARNNING!!!") = vbOK Then If stDocName = "Returned" Or stDocName2 = "Returned" Or stDocName3 = "Returned" Then DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70 End If End If Exit_DeleteEntry_Click: Exit Sub Err_DeleteEntry_Click: MsgBox Err.Description Resume Exit_DeleteEntry_Click End Sub