IIf

  • Thread starter Thread starter BB
  • Start date Start date

BB

Registered User.
Local time
Today, 00:48
Joined
Aug 31, 2001
Messages
30
I need to print a "44" (earnings code) in a report if the AccountNumber starts with a 2; otherwise, I need to print "45". I am dealing with account numbers 0-00000 to 9-99999. I think the account numbers are stored without the hyphen. (I am using an input mask, 0\-00000.)
I think the following works, but is there a better way??
Is there anything like a wildcard (2*) I can use?

=IIf([AcctCharged]>="200000" And [AcctCharged]<="299999","44","45")

Thanks,
(A Beginner)
 
If you are sure that the first character of the text field is a 2, something like this should work:

Iif(Left$([AcctCharged])="2","44","45")

If you are looking for the 2 somewhere else in the string, check out the Mid$ function.
 

Users who are viewing this thread

Back
Top Bottom