iif & And statement in Access

ianuk1983

Board Regular
Joined
Oct 30, 2006
Messages
104
Hello guys,

Still starting out in access I have the following I'm looking to try and do which I built in the expession builder, which doesnt work.

Package: IIf([Voice]>0 And [Blackberry]>0,"Voice & BB","")

I'm simply trying to do a =if(and( statement as I know it in excel. can anyone let me know were i'm going wrong?

Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Marbles

Well-known Member
Joined
Feb 7, 2005
Messages
626
It looks okay, what results are you getting, and from what field types?
 

ianuk1983

Board Regular
Joined
Oct 30, 2006
Messages
104
If the field Voice & Blackberry are both greater than 0. In the new field the message
#Error
 

Marbles

Well-known Member
Joined
Feb 7, 2005
Messages
626
It sounds like you have one of the fields as text instead of number.
 

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,452
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Hi Ian

Is this in a query? If so can you post the full SQL for the query? You can get into the SQL when in the query design screen by clicking on menu option View > SQL View. If this is not in query can you explain where you are using this expression?

Andrew
 

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,452
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Absolutely yes! Finally someone recognised it!!!!!

I sat and watched the movie again the other night. I so thoroughly enjoyed the duelling banjo scene that I decided to change my avatar to Lonny from that scene. IMO that has to be one of the most memorable movie scenes.

Cheers
Andrew
 

Marbles

Well-known Member
Joined
Feb 7, 2005
Messages
626
I usually watch Deliverance until few minutes after that scene, then turn it off.
 

ianuk1983

Board Regular
Joined
Oct 30, 2006
Messages
104
Looks to be working now, but I'm working for a way to include 3 fields
example

IIf([Voice]>0 And [Blackberry]>0 And [Data]>0," Voice Data & BB"

but is on looking at the first two, is this even possible?
or a way round this?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,357
Office Version
  1. 365
Platform
  1. Windows
ian

It should be possible.

But I think you need to answer Marbles original question about the field data types.

Also is it possible for any of the fields to be empty?
 

Forum statistics

Threads
1,181,103
Messages
5,928,077
Members
436,587
Latest member
Slicesofquince

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
Top