Combo Box Value

S

Saj

Hi to anyone that can help

I have the following code in my afterupdate:

If stockNo.Column(1) < quantity.value Then
MsgBox "Quantiy is greater than stock available"
End If

When I run this code it ignores the value in the stockno.column(1), it sees
it as a "7" and quantity has 8 yet doesnt fall into the msgbox just goes to
endif.
Is this because it sees the stockno.coloumn(1) as text and not a number?

If so, how do I get it to see it as a number?

Would appreciate some help to possibly a very simple question to lots out
there ;o)

Thanks in advance
 
D

Douglas J. Steele

Are you sure that Column(1) is the correct column? That will actually be the
2nd column in the combobox: the Column collection starts at 0, not 1.

If you do have the correct column, you could use

If Val(stockNo.Column(1)) < quantity.value Then

or

If CLng(stockNo.Column(1)) < quantity.value Then
 

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