IIf or Switch

P

Paul LeBlanc

I have tried several different ways to get this to come out but seem to have
a syntax problem in Access 2000
These are my two best shots neither of which work, I can't even get out of
the design window. I'm sure I'm missing something simple

PRODUCT:(IIf(Mid$([TblHibPropAll]![PLOT]),1,2)="10","QS",IIf(Mid$([TblHibPropAll]![PLOT]),1,1)="A","STOCK","6 Inch")

PRODUCT:Switch(Mid$[TblHibPropAll]![PLOT],1,2)="10","QS",(Mid$[TblHibPropAll]![PLOT],1,1)="A","STOCK",True, "6 Inch")
 
J

Jerry Whittle

I think that you have a couple of ) in the wrong place. Try this:

PRODUCT: IIf(Mid$([TblHibPropAll]![PLOT],1,2)="10", "QS",
IIf(Mid$([TblHibPropAll]![PLOT],1,1)="A", "STOCK", "6 Inch"))
 
J

John Spencer

Perhaps the following

PRODUCT:
IIf(Mid$([TblHibPropAll]![PLOT],1,2)="10","QS",IIf(Mid$([TblHibPropAll]![PLOT],1,1)="A","STOCK","6
Inch"))

Note that you were closing the Mid$ function before you gave it the start
and length. Personnally, I would have used
IIF ([Plot] Like "10*", "QS",IIF([Plot] Like "A*","STOCK","6 Inch"))
--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
P

Paul LeBlanc

Thanks John And Jerry both.
I used John's solution for its simplicity

John Spencer said:
Perhaps the following

PRODUCT:
IIf(Mid$([TblHibPropAll]![PLOT],1,2)="10","QS",IIf(Mid$([TblHibPropAll]![PLOT],1,1)="A","STOCK","6
Inch"))

Note that you were closing the Mid$ function before you gave it the start
and length. Personnally, I would have used
IIF ([Plot] Like "10*", "QS",IIF([Plot] Like "A*","STOCK","6 Inch"))
--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Paul LeBlanc said:
I have tried several different ways to get this to come out but seem to
have
a syntax problem in Access 2000
These are my two best shots neither of which work, I can't even get out of
the design window. I'm sure I'm missing something simple

PRODUCT:(IIf(Mid$([TblHibPropAll]![PLOT]),1,2)="10","QS",IIf(Mid$([TblHibPropAll]![PLOT]),1,1)="A","STOCK","6
Inch")

PRODUCT:Switch(Mid$[TblHibPropAll]![PLOT],1,2)="10","QS",(Mid$[TblHibPropAll]![PLOT],1,1)="A","STOCK",True,
"6 Inch")
 

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