Suggersico le parentesi:
if (Trim(txtNome.Text) = "") or (Trim(TxtCognome.Text) = "") Then
MsgBox "Inserisci i dati mancanti", vbExclamation
end if