If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: re: If statement

What I really need is an If statement to validate the value of an input variable. It is a string variable. EX: 03325587
03 is the last 2 digits of the current yr (can't lesser than previous yr or greater than next year)
325 is the Julian yr (it is valid if it is between 1-365)
587 is auto count (can't be greater than 999)
If any of the condition is true then return false to check_lotum and exit function. I know there has to be a better way to write this code. Please help. Thanks!

'Is it between but not 0 and between but not 366.
'In other words, 1 to 365 is valid.
If Jul < 1 Or Jul > 365 Then Exit Function

'We do not need to worry about the Auto Count for the
'simple reason that any number greater than 999 will
'add one additional digit to the overall string thus
'making it 9 characters long. We have already established
'at the beginning of this function that this as illegal.

'If there have been no errors and all the conditions
'are met, we return a 'True' otherwise this function
'will return 'False'
If Err = 0 Then Check_Lotnum = True

'Is it between but not 0 and between but not 366.
'In other words, 1 to 365 is valid.
If Jul < 1 Or Jul > 365 Then Exit Function

'We do not need to worry about the Auto Count for the
'simple reason that any number greater than 999 will
'add one additional digit to the overall string thus
'making it 9 characters long. We have already established
'at the beginning of this function that this as illegal.

'If there have been no errors and all the conditions
'are met, we return a 'True' otherwise this function
'will return 'False'
If Err = 0 Then Check_Lotnum = True