Sometimes the "Block If" error can be misleading. In this case you can take it literally.
Also, looks like you may need a bucket to collect the value of your msgbox.
Code:
Private Sub Command159_Click()
Dim intResponse as integer
intResponse = MsgBox "Any data you entered will not be saved!", vbOKCancel
If intResponse = vbOKCancel Then
Undo
DoCmd.Close acForm, "frmDataEntry", acSaveNo
elseIf intResponse = vbOKCancel Then
Exit Sub
End If
End Sub
Try that and see if it works
Edit, noticed some other stuff too. Deleted a copy things