Reputation: 7966
I want to prevent the code execution if user leave a textbox empty
If tx01.Value = "" Then Exit Sub
If tx01.Value = vbNullString Then Exit Sub // also tried
But user can simply write a space (or any number of spaces) and - prevention doesn't work.
I need characters in this box (numeric and nonNumeric), but not only spaces.
How can I do this, pls ?
Upvotes: 3
Views: 6983
Reputation: 20330
something like
if trim(tx01.Value) = "" then Exit sub
Trim removes leading and trailing whitespace characters.
Upvotes: 4