need advice on 0, "" , " "

G

Guest

Hi All,

I do not know what is the best way for the below syntax. Any better function
instead of using 0, "" or " " although it can work. Now I afraid if user
enter " " which is 2 spaces then the program unable to detect.
Need the advice.
Thanks

If qty = 0 Or qty = " " Or qty = "" _
Or item = " " Or item = "" Then
MsgBox ("Part Number and Quantity Must Input!")
 
D

Die_Another_Day

you can use this to detect a variable amount of spaces.
if qty = Space(Len(qty))
is your part number all numeric? is there a way you can check a list to
see if it matches and return an error if it doesn't?

HTH

Die_Another_Day
 
G

Guest

Hello,

I suggest you could use function TRIM(text). TRIM() could get rid of the
space on both sides and keep one space between two words.If you define
variable as string, you can do as follows:

if trim(qty)="" or trim(qty) = "0" then
....

Hope it works!

Viesta
Shanghai, CN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top