473,465 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Formating return value in IIF statement not working

Jerry Maiapu
259 Contributor
The following is giving error in query:
Expand|Select|Wrap|Line Numbers
  1. Credit: IIf([Overtime]="AOT" Or [ClockIn]="Weekend" Or [ClockIn]="Holiday","0.00",
  2. Format([HrtMints]-8.35),"Fixed"))
  3.  
It was fine but gives error when I tried to format the False portion of the IIF statement. Want to return a fixed value.

Expand|Select|Wrap|Line Numbers
  1.  Format([HrtMints]-8.35),"Fixed"
Even this does not work:

Expand|Select|Wrap|Line Numbers
  1. Credit: Format(IIf([Overtime]="AOT" Or
  2. [ClockIn]="Weekend" Or [ClockIn]="Holiday","0.00",[HrtMints]-8.35),"Fixed")
Help appreciated
Aug 11 '10 #1

✓ answered by NeoPa

You have a closing parenthesis ")" after your 8.35 Jerry ;)

4 1712
NeoPa
32,556 Recognized Expert Moderator MVP
You have a closing parenthesis ")" after your 8.35 Jerry ;)
Aug 11 '10 #2
Jerry Maiapu
259 Contributor
Sometimes we are so busy that we find quite hard to spot such small mistakes.
Thanks a lot Neo.


This worked though
Expand|Select|Wrap|Line Numbers
  1. Credit: Format(IIf([Overtime]="AOT" Or
  2.     [ClockIn]="Weekend" Or [ClockIn]="Holiday","0.00",[HrtMints]-8.35),"Fixed")
  3.  
Aug 12 '10 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Absolutely Jerry :)

I should point out though, even though it may not be important to you now, that what you posted may look as if it's worked, but technically doesn't. It will give you what you're after sure enough, but when it resolves to True the format of fixed is not effective. For that to work as I imagine you intended, you would need either :
Expand|Select|Wrap|Line Numbers
  1. Credit: IIf([Overtime]='AOT' Or
  2.             [ClockIn]='Weekend' Or
  3.             [ClockIn]='Holiday','0.00',Format([HrtMints]-8.35,'Fixed'))
or :
Expand|Select|Wrap|Line Numbers
  1. Credit: Format(IIf([Overtime]='AOT' Or
  2.                    [ClockIn]='Weekend' Or
  3.                    [ClockIn]='Holiday',0,[HrtMints]-8.35),'Fixed')
This is being pretty picky though. I just wanted to bring the point to your attention in case you weren't aware.
Aug 12 '10 #4
Jerry Maiapu
259 Contributor
Thanks for that Neo.

I will use either of them
Aug 12 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mad Scientist Jr | last post by:
I am populating a dropdownlist from SQL. The query returns the correct values (and no NULLs in any fields). The listitem.value is populated with an int ID field, and listitem.text with a varchar...
2
by: Leon | last post by:
Can you write over a value in session or do you have to delete the value first then re-create it? **Example: I have the following value in session state... Statement 1 -- Session.Add("Email",...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
6
by: ineedahelp | last post by:
I have been working on trying to get some code to work in an ON CLICK EVENT. I am having trouble with the syntax of an SQL statement. The program was stopped without running to completion many...
8
by: grpramodkumar | last post by:
HI, function change(value,sub) { subcat = document.getElementById(sub); subcat.options.value = value; }
4
by: Badboy112 | last post by:
Hi guys im not sure what i am doinf wrong but the if statement in the action performed is not working any ideas import java.io.*; import javax.swing.*; import java.awt.*; import...
2
by: Taftheman | last post by:
Hi, I have created a pop up using js and returns a value for me to process. I have got it working. I now need to do it again for another button. The value return will be processed differently. But as...
10
by: gyanendar | last post by:
Hi All, I want to access new value after upadate in statement level trigger. But in my query I am getting old values. Here is the Trigger Code: CREATE OR REPLACE TRIGGER TEST_TRIGGER AFTER...
0
prabirchoudhury
by: prabirchoudhury | last post by:
CRITERIA; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+...
25
by: LBinGA | last post by:
Hello all: I'm having trouble with a nested If Statement working properly. I'm working in MS Access 2002 (OS Windows XP, ver 2002). The non-working code is going on the Form (a Single) as follows:...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.