Originariamente inviato da steno12
ok1 = 0: ok2 = 0
If Trim(txtCognome) = "" Then ok1 = ok1 + 1
If Trim(txtNome = "") = "" Then ok2 = ok2 + 1
If ok1 + ok2 = 2 Then MsgBox "dati mancanti in txtCognome e txtNome": Exit Sub
If ok1 = 1 Then MsgBox "dati mancanti in txtCognome": Exit Sub
If ok2 = 1 Then MsgBox "dati mancanti in txtNome": Exit Sub
con exit sub rimani sempre nel form, in più, in questo modo proposto controlli qual'è la text vuota........
anche se quì togli else il vb ti darà un errore!!!!!!!!!
........perchè le parentesi sono errate
If ((Trim(txtCognome.Text) <> "") And (Trim(txtNome.Text) <> "")) Then
Else
End If