Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Clark Butler   on Oct 19 In MS Office Category.

  
Question Answered By: Hubba Akhtar   on Oct 19

I assume you are either defining iGroupNum as integer or allowing it to be
defined automatically as integer.

Functions like Right, etc, work on strings, and might get in trouble with
integers.

Put an explicit definition in for iGroupNum as String (or perhaps call it
sGroupNum for correctness). Alternatively, use Mod and Int functions to act
directly on the integer values instead.

However, also ...

If Right(iGroupNum, 2) = "01" Or "02" Then

the "Or "02"" will always be true, probably. You need a complete test.

If Right(iGroupNum, 2) = "01" Or Right(iGroupNum, 2) = "02" Then

And, I don't know what you are expecting

If Right(iGroupNum, 2) <> "01" Or "02" Then
iGroupNum = iGroupNum
End If

to do. Even when you fix the If, the assignment statement doesn't do
anything. BTW for <>, you want to use "And", not "Or".

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Len function help Or get search suggestion and latest updates.


Tagged: