Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-13-2019, 02:18 AM   #1
MushroomKing
Newly Registered User
 
MushroomKing's Avatar
 
Join Date: Jun 2018
Location: The Netherlands
Posts: 88
Thanks: 55
Thanked 1 Time in 1 Post
MushroomKing is on a distinguished road
Query ifff statement with calculation?

Hi everyone!

I have a small question that im unable to find the exact solution for.
It's driving me craaaaazy

I have a query where I want to apply this:

actualtime: IIf([daytext]="vrijdag" Or "Friday",([timediff]-48))


Now obviously its not working...but why?

If my daytext is equal to vrijdag or Friday, I want to subtract 48 from my timediff value.


Could someone help me out with this small but annoying expression?
Thanks in advance!!!

__________________
Humor, also has it's fun sides...
MushroomKing is offline   Reply With Quote
Old 11-13-2019, 02:35 AM   #2
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,798
Thanks: 455
Thanked 908 Times in 872 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: Query ifff statement with calculation?

You need True and False arguments I would have thought?

However try

Code:
IIf([daytext]="vrijdag" Or [daytext] = "Friday",([timediff]-48))
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
Old 11-13-2019, 02:56 AM   #3
MushroomKing
Newly Registered User
 
MushroomKing's Avatar
 
Join Date: Jun 2018
Location: The Netherlands
Posts: 88
Thanks: 55
Thanked 1 Time in 1 Post
MushroomKing is on a distinguished road
Re: Query ifff statement with calculation?

Hi Gasman! Always good to see you in the thread

Still doesn't work for some reason. I get an #error in my field.



(sorry, will quote with code tag next time, its corrected)

__________________
Humor, also has it's fun sides...
MushroomKing is offline   Reply With Quote
Old 11-13-2019, 03:01 AM   #4
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,959
Thanks: 120
Thanked 3,331 Times in 3,005 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Query ifff statement with calculation?

As Gasman said you also need a 'false' argument. For example

Code:
IIf([daytext]="vrijdag" Or [daytext] = "Friday",[timediff]-48, 1234)
Replace 1234 with whatever you want when daytext is neither of those values

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Spam, spam, spam, spam, spam, spam, spam (Terry Jones - RIP)
isladogs is offline   Reply With Quote
Reply

Tags
calculate , iff statement , query , subtract , timediff

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
If statement with Calculation reggiete Modules & VBA 15 11-28-2015 12:41 PM
IIF statement calculation hedge Forms 1 05-23-2011 04:31 AM
IIf statement with Calculation karl009 Queries 4 03-10-2010 08:20 AM
calculation using iif statement orangelightblub Queries 1 04-06-2005 04:09 PM
Calculation if Statement sandylt Forms 7 04-02-2004 12:46 PM




All times are GMT -8. The time now is 12:40 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World