access iif function
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access Training and help » Access => IIF Function

Access => IIF Function

resolvedResolved · Urgent Priority · Version 2007

replyReply Wed 17 Nov 2010, 13:52Delegate Salima said...

Salima has attended:
Access Intermediate course
Excel VBA Intro Intermediate course

Access => IIF Function

Hiya,

I am trying to run an IIF statement question, however Access seems to ignore the second part of the IIF statement and return results for the first part of the argument only.

I expect to see two different results depending on whether the Currency is 'GBP' or 'USD'

CCY_Port_Value: IIf("dbo_CURRENCIES.BRIEF_DESC_ENG='GBP'",Sum(DSum("DEAL_AMOUNT","QRY_RESIDUAL_VALUE_TABLE"," dbo_CURRENCIES.BRIEF_DESC_ENG='GBP'")),IIf("dbo_CURRENCIES.BRIEF_DESC_ENG='USD'",Sum(DSum("DEAL_AMOUNT","QRY_RESIDUAL_VALUE_TABLE"," dbo_CURRENCIES.BRIEF_DESC_ENG='USD'"))))

I look forward to your response.

Many Thanks
Salima

For upcoming training course dates see: Pricing & availability

replyReply Thu 18 Nov 2010, 11:20Trainer Simon said...

RE: Access => IIF Function

Hi Salima,

Thank you for your question.

I will consult with a colleague and if we find a solution I will email you today before close of play.

Regards

Simon

replyReply Mon 29 Nov 2010, 14:18Trainer Stephen said...

RE: Access => IIF Function

Hi Salima

Thanks for your question

Can you clarify what happens when the currency is USD, the second part of your argument. Does the function return nothing, or does it return the value for GBP instead

Thanks

Stephen

replyReply Mon 29 Nov 2010, 14:21Delegate Salima said...

RE: Access => IIF Function

Hi Stephen,

It returns the GBP value instead, it's almost as it is disregards the second argument of the IIF function, if I switch the arguments around then the formula returns the USD value irrespective of currency.

Cheers
Salima

replyReply Tue 30 Nov 2010, 10:42Trainer Stephen said...

RE: Access => IIF Function

Hi Salima

If you only have the two currencies, GBP and USD (as appears to be the case) then you do not require a second IIF statement as both contingencies are covered in the truepart and falsepart arguments of the first IIF statement. Without seeing your database it is difficult to be precise, but I suggest something alomng the lines of

CCY_Port_Value: IIf("dbo_CURRENCIES.BRIEF_DESC_ENG='GBP'",Sum(DSum("DEAL_AMOUNT","QRY_RESIDUAL_VALUE_TABLE"," dbo_CURRENCIES.BRIEF_DESC_ENG='GBP'"),Sum(DSum("DEAL_AMOUNT","QRY_RESIDUAL_VALUE_TABLE"," dbo_CURRENCIES.BRIEF_DESC_ENG='USD'"))

So the truepart adds up values where the currency is GDP, and the falsepart values where it is not GDP, i.e USD.

If there are in fact other currencies, what are they and what results do you want returning for them

Regards

Stephen

Mon 6 Dec 2010: Automatically marked as resolved.

 

Please browse our web site to find out more about
access/courses and other Microsoft training courses.

Access tip:

Duplicating an Entry

To duplicate the entry press CTRL+' (apostrophe)this will copy the contents of the previous entry in the same field.
(Table view, line above) note this also works in Excel.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard