textbox value evaluation?

S

Sean

Hi,
I have a question about my code posted below. For some reason, if
txtCurrentWeek.Value = 5 and txtTotalWeek.Value = 21, the msgbox will be
displayed, even though it shouldn't. I belive it has to do with the value
not being read as an integer or the length of the value (I assumed this
because if I set 'current' = 1 or = 2 and 'total' = 21, I get no error
message. Do I have to declare these .values as integers or to have a
specific length? If so how do I do that?

If txtCurrentWeek.Value > txtTotalWeek.Value Then
MsgBox "Current project week cannot exceed the total number of project
weeks.", vbOKOnly, "Error"
Exit Sub
End If

Thanks.
 

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