3

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 ?

2 Answers 2

4

something like

if trim(tx01.Value) = "" then Exit sub

Trim removes leading and trailing whitespace characters.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, that's it. ThankYoy - Tony and Ratan.
4

Try adding a Trim() in the textbox value check.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.