calculating a field in a query... 
Author Message
 calculating a field in a query...

I am having problems calculating a field in a query. I have two suppliers
and the field needs to calculate according to what supplier is loaded in the
"vendor name" field in the query. Here's what I have built into the field
box in the QBE:
 IIf([Vendor Name]='BDCI' Or 'GPA',[Mfg Cost $]*0.00335,[Invoice]*0.00335)
The field seems to totally ignore the if statement and just calculates the
field as [Mfg Cost $]*0.00335. Any suggestions?

Thanks,
 Shelley



Sat, 31 May 2003 05:41:40 GMT  
 calculating a field in a query...
Have you tried

    IIf([Vendor Name]='BDCI' Or [Vendor Name]='GPA',
        [Mfg Cost $]*0.00335,[Invoice]*0.00335)

?
(line wrapped for readability)
--

Dirk Goldgar
(remove NOSPAM from reply address)


Quote:
> I am having problems calculating a field in a query. I have two suppliers
> and the field needs to calculate according to what supplier is loaded in
the
> "vendor name" field in the query. Here's what I have built into the field
> box in the QBE:
>  IIf([Vendor Name]='BDCI' Or 'GPA',[Mfg Cost $]*0.00335,[Invoice]*0.00335)
> The field seems to totally ignore the if statement and just calculates the
> field as [Mfg Cost $]*0.00335. Any suggestions?

> Thanks,
>  Shelley



Sat, 31 May 2003 06:03:44 GMT  
 calculating a field in a query...
Shelley,

I do not think you can use the OR operator inside an IIF() statement.

Instead, try using a nested IIF().

David

Quote:
>Subject: calculating a field in a query...

>Date: 12/11/00 1:41 PM Pacific Standard Time

>I am having problems calculating a field in a query. I have two suppliers
>and the field needs to calculate according to what supplier is loaded in the
>"vendor name" field in the query. Here's what I have built into the field
>box in the QBE:
> IIf([Vendor Name]='BDCI' Or 'GPA',[Mfg Cost $]*0.00335,[Invoice]*0.00335)
>The field seems to totally ignore the if statement and just calculates the
>field as [Mfg Cost $]*0.00335. Any suggestions?

>Thanks,
> Shelley



Sun, 01 Jun 2003 09:45:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. table.field value calculated based on query

2. How to update calculated fields in SQL query?

3. Calculating Values in a Query

4. Calculated Query

5. calculating query runtime

6. Calculating with queries

7. Can't sort result set on query based on calculated values

8. Creating Calculated field in table

9. Calculating Average of Grade Fields

10. Updating Calculated field depending on Current Date

11. Changing a Calculate field (Date) depending on Current date

12. Newbie - assigning calculated value to table field

 

 
Powered by phpBB® Forum Software