Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF and time compare

Status
Not open for further replies.

Milleniumlegend

IS-IT--Management
Dec 16, 2003
135
I am trying to run a query on a table and want to see if the time is less than 14:00 hours. If so then multiply a field in the same table by .90.

The table contains the following Fields
Customer Id
Party Date
Start Time in AM/PM format
Total Cost

I would like to check on the query to see if the Start Time is before 14:00 or 02:00 PM and if so then multiply the total cost by 0.90 otherwise leave the total cost as it is.

Could someone please let me know how this is done.

I wrote something like this but that would not work.

IIf([Party Order].[Start Time]<1400,[Party Order]![Total Cost]=[Party Order]![Total Cost]*0.9,[Party Order]![Total Cost])
 
looks like you are trying to update the value of Total Cost?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
In the query grid:
CalculatedCost: IIf([Party Order].[Start Time]<#14:00:00#, [Party Order].[Total Cost]*0.9, [Party Order].[Total Cost])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I get the following error. You tried to execute a query that does not include the specified expression.

'Sum([Party Order].[Total Cost])=IIf([Party Order].[Start Time]<#12/30/1899:2:0:0PM#,[Party Order].[Total Cost]=[Party Order].[Total Cost]*0.9,[Party Order].[Total Cost])'
as part of an aggregate function.

Could you please tell me what may be wrong here.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top