Question regarding IIf

  • Thread starter Thread starter Claes D
  • Start date Start date
C

Claes D

Hello all.
Im not very good at querys, so pls dont laugh. ;)

I cant really get it to work.
Is it at all possible to do this?

ArtNr:
IIf([ArticleNumber]="600#######";Left([ArticleNumber];LEN([ArticleNumber])-2);Left([ArticleNumber];LEN([ArticleNumber])-3))

In my desperation I have also tried Format, but the same thing happends.
It uses the Left with LEN -3 all the time.

Any suggestions?
 
If the # is meant to be a wild card representing any digit, use the Like
operator:
ArtNr: IIf([ArticleNumber] Like "600#######", ...

If ArticleNumber is a Number field (not a Text field), you could use:
ArtNr: IIf(Int([ArticleNumber] / 10000000) = 600, ...
 
Perhaps you can describe what you are attempting to accomplish in words.
The expression looks like it should work.

PERHAPS what you want is
IIF(ArticleNumber LIKE "600######"; Left(ArticleNumber;
7);Left(ArticleNumber;6))

That would check for Article numbers that start with 600 followed by exactly
6 number characters. If there is a match, return the first 7 characters,
otherwise return the first 6 characters.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top