id_dostwacy is field which hold unique ID of record and is aumatically entered by acNewRec now I have Cancel button on form and when I press it without enterin fields on form like name, second name etc it was crashing due to NULL value in id_dostawcy so I made this code but it never go to else code even if dostwacy_id is filled.Code:Private Sub Anuluj_Click() Dim final As String Dim data As String If Nz(id_dostawcy, "") & "" <> "" Then DoCmd.Close DoCmd.OpenForm "Dostawcy_główny" Else DoCmd.SetWarnings False MsgBox ("CHECK") data = id_dostawcy.Value DoCmd.Close final = "DELETE * FROM Dostawcy WHERE id_dostawcy = " & data & ";" DoCmd.RunSQL final DoCmd.OpenForm "Dostawcy_główny" DoCmd.SetWarnings True End If End Sub