Trouble with expression

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I'm having some trouble getting a query to return a value. Here is the
expression of a field I have in a query:

ManufHrs: IIf([CBDCode]="Manufacturing",[Quantity]*[BuildingLaborHours],0)

I now have 2 potential values: "Manufacturing" or "Manufacturing (2-06-100)
", so I thought I could utilize a wildcard character to cover both. I tried
changing the expression to this:

ManufHrs: IIf([CBDCode]="Manuf*",[Quantity]*[BuildingLaborHours],0)

It now returns a value of zero for every record, so "Manuf*" must not be
correct. I tried variations of that using "Like" with it, but kept getting
error messages.

Any suggestions?
Thanks in advance!
 
J

John Spencer

THe following should work

ManufHrs: IIf([CBDCode] LIKE "Manuf*",[Quantity]*[BuildingLaborHours],0)

If that fails, you might need

ManufHrs: IIf([CBDCode] LIKE "Manuf%",[Quantity]*[BuildingLaborHours],0)
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
J

John W. Vinson

I'm having some trouble getting a query to return a value. Here is the
expression of a field I have in a query:

ManufHrs: IIf([CBDCode]="Manufacturing",[Quantity]*[BuildingLaborHours],0)

I now have 2 potential values: "Manufacturing" or "Manufacturing (2-06-100)
", so I thought I could utilize a wildcard character to cover both. I tried
changing the expression to this:

ManufHrs: IIf([CBDCode]="Manuf*",[Quantity]*[BuildingLaborHours],0)

It now returns a value of zero for every record, so "Manuf*" must not be
correct. I tried variations of that using "Like" with it, but kept getting
error messages.

Any suggestions?
Thanks in advance!

The = operator does not recognize wildcards as wildcards. Try

IIF(Left([CBDCode], 5) = "Manuf", ...

John W. Vinson [MVP]
 

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

Similar Threads


Top