Using Iif and eval in MS access

aravindkm

Board Regular
Joined
Feb 9, 2017
Messages
50
Hi All,

I tried using If and Eval function in MS Access while im getting the data in access however it is throwing a Syntax error.

My requirement is if the currency code is equal to GBP,USD,EUR,HKD the reporting currency column should have respective currency codes.

If other than GBP,USD,EUR,HKD the reporting currency column should have "OTH". While trying to implement this I used iif and eval function have had an syntax error.

The formula used is IIf(Eval([CURRENCY] In ("GBP","USD","EUR","HKD")),"AA","OTH") could anyone please let me know what's the issue with the formula I have used and also let me know what should be used.

Thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Don't see what AA is doing either, since you want the currency code if its in the list. So adding to the above, try:
Code:
 IIf([CURRENCY] In ("GBP","USD","EUR","HKD"),[Currency],"OTH")
 
Upvote 0
One more help I want 3 columns to be using a sum (Total) function.

Like I Have a columns
Balance /Balance in foreign Currency and Balance Limit.

I want all this 3 columns to be totaled when I filter it with currency.

Can you please help me with the formula.
 
Upvote 0
In Access, SUM works on a single field (column) across multiple records (rows), when grouping by specific fields.
SUM does not work across multiple fields.
If you wanted to SUM multiple fields across a single record, you would just add them up, i.e.
Code:
MySum: [Field1] + [Field2] + [Field3]
 
Upvote 0
You are welcome.
 
Upvote 0
Hi Joe4,

Can you please help me in the below.

In excel we can use Vlookup function to match two sheets. is there the same kind of function available in MS access where we can see the matched and unmatched lines between 2 tables.

Kindly help on this
 
Upvote 0
You use Queries in Access for that. You simply join the two tables on the the fields you want to "lookup" on, and return the fields that you want to see.
It is one of the most basic things you can do in Access, so if you are not familiar with it, I would recommend getting some introductory Access book, tutorial, or training, that can give you detailed instructions on how to do that. Iif you are going to use Access, it is essential that you know how to create queries between tables.

Also, Access actually has a built-in Query Wizard to help you set up Unmatched Queries.

Here is one article from a Google Search on creating multi-table queries in Access. You can find a bunch more (including YouTube tutorials) with a Google Search:
https://www.gcflearnfree.org/access2013/designing-a-multitable-query/1/
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,249
Members
448,879
Latest member
oksanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top