IFF

J

Jens R. Rasmussen

I have a report which lists the records from a table containing the field
HVILKET and the field BETALT.
Now I want only to show BETALT if HVILKET = "kommer".

Therefore I have tried in the the control source to write

IFF([HVILKET]="kommer";[BETALT];"-")

It works fine for HVILKET <> "kommer", but when HVILKET = "Kommer" I get an
error (#error) in stead of the expected value for BETALT

So my syntax must be in error. please help.

regards
/jens
 
J

Jeff Boyce

Jens

Have you tried searching for IIF() in Access HELP? I believe the correct
syntax is shown there.

Regards

Jeff Boyce
Microsoft Access MPV

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
M

Marshall Barton

Jens said:
I have a report which lists the records from a table containing the field
HVILKET and the field BETALT.
Now I want only to show BETALT if HVILKET = "kommer".

Therefore I have tried in the the control source to write

IFF([HVILKET]="kommer";[BETALT];"-")

It works fine for HVILKET <> "kommer", but when HVILKET = "Kommer" I get an
error (#error) in stead of the expected value for BETALT


Just in case tho misspelled IIf is a typo, check to make
sure that the text box is NOT named BETALT
 
D

Duane Hookom

The control source is missing "=" at the beginning. Also, the function is
IIf() not IFF().

Is BETALT a field in your report's Record Source?
 
J

Jens R. Rasmussen

"Duane Hookom" skrev:
The control source is missing "=" at the beginning. Also, the function is
IIf() not IFF().

yes, sorry for writing too quickly. However I have wrote
=IIF([HVILKET]="kommer";[BETALT];"-")

and when HVILKET said:
Is BETALT a field in your report's Record Source?

Yes containing figures like 250,00
--
Duane Hookom
Microsoft Access MVP
regards
/Jens
Jens R. Rasmussen said:
I have a report which lists the records from a table containing the field
HVILKET and the field BETALT.
Now I want only to show BETALT if HVILKET = "kommer".

Therefore I have tried in the the control source to write

IFF([HVILKET]="kommer";[BETALT];"-")

It works fine for HVILKET <> "kommer", but when HVILKET = "Kommer" I get an
error (#error) in stead of the expected value for BETALT

So my syntax must be in error. please help.

regards
/jens
 
J

Jens R. Rasmussen

"Marshall Barton" skrev:
Jens said:
I have a report which lists the records from a table containing the field
HVILKET and the field BETALT.
Now I want only to show BETALT if HVILKET = "kommer".

Therefore I have tried in the the control source to write

IFF([HVILKET]="kommer";[BETALT];"-")

It works fine for HVILKET <> "kommer", but when HVILKET = "Kommer" I get an
error (#error) in stead of the expected value for BETALT

check to make sure that the text box is NOT named BETALT

that was the mistake. Now I rename the box to BETALING and in the control
elements I use the FIELD BETALT.

thank you for your help.
regards
/Jens
Marsh
MVP [MS Access]
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sum 3
IIF Syntax error 4
IFF Between...And 2
iff and data source? 1
Defaulting Blank Fields to "------" 6
Printing parameter value on report 5
iff statements 3
Syntax of IF ELSE statement in control source 10

Top