Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If...the...else statements

Status
Not open for further replies.

amrnewman

Technical User
Dec 9, 2004
33
GB
Hi

I have what is a simple quey but I am struggling with syntax in Access - I dont use it much as most of my work is in Crystal Reports.

I have a text field in a table that is a value list combo-box containing the sub-programme of a research project - Change Management, E-Health etc. It is mandatory to specify a MAIN programme of research but not a sub-programme.

When I report using this field and group by programme and then sub-programme, if the sub-programme is blank it leaves a gap in the report which looks messy - aesthetics!!!

I want to add "No sub-programme defined" as text if the sub-programme is blank and have tried numerous versions of if...then...else statements but cannot get the syntax correct.

if (is null[subprogramme]) then "No sub-programme defined" else [subprogramme]

Help!!! Sure this is very simple.

Ade
 
are you trying to use this directly in a query?

if so, then the syntax is IIF(condition test, valueIfTrue, valueIfFalse)

--------------------
Procrastinate Now!
 
Oh, forgot to mention, in your specific case, you can use NZ(field, valueIfNull)

--------------------
Procrastinate Now!
 
Thanks Crowley16 - NZ worked perfectly. One day I'll get the hang of this!

Ade
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top