Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim obavezno As Control, EmptyStr$
For Each obavezno In Me.Controls
If Right(obavezno.Name, 3) = "_ob" Then
If IsNull(obavezno.Value) Or obavezno.Value = vbNullString Then
EmptyStr = EmptyStr & obavezno.Name & ";"
obavezno.BackColor = RGB(255, 192, 203)
End If
End If
Next
If EmptyStr <> vbNullString Then
EmptyStr = Left(EmptyStr, Len(EmptyStr) - 1)
If MsgBox("Niste popunili neka obavezna polja: " & vbCrLf & EmptyStr & vbCrLf & "Ako želite da prekinete kliknite na Yes", vbExclamation + vbYesNo, "Brisanje artikla") = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
DoCmd.GoToRecord , , acLast
Else
Me.Undo
End If
End If
End Sub