A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can I use an IIF statement with the NZ function?



 
 
Thread Tools Display Modes
  #1  
Old November 23rd, 2009, 06:57 PM posted to microsoft.public.access.queries
Marge
external usenet poster
 
Posts: 84
Default Can I use an IIF statement with the NZ function?

I have an Employee Roster database; one of the tables tracks up to 9
promotions, transfers, reassignments, etc. (called "Movements"), and their
related dates for each employee. Some Movements effect an employee's
evaluation date, where other dates do not effect the evaluation date. The
Movement Dates each have a related true/false field to indicate whether the
employee's evaluation date will change because of the Movement.

Movement Date 1 Evaluation change 1 Movement Date 2 Evaluation change 2
1/25/08 False 3/7/09
True
11/3/07 True 6/5/98
False

With the NZ function I can ask the query to check for the most recent of the
9 Movement Dates or to return the Hire Date if no Movement Date is found:

Eval Date: NZ([movement date 9],NZ([movement date 8],NZ([movement date
7],NZ([movement date 6],NZ([movement date 5],NZ([movement date
4],NZ([movement date 3],NZ([movement date 2],NZ([movement date 1],[T-PD
Roster.hire date])))))))))

What I need to do is to ask the query to check for the most recent of the 9
Movement Dates that have a True Evaluation change field.

I think I need to use an IIF statement to isolate the True dates.

I could really use your help; any assistance will be greatly appreciated.
  #2  
Old November 23rd, 2009, 08:20 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Can I use an IIF statement with the NZ function?

I think I need to use an IIF statement to isolate the True dates.
No, you need to change your table structure from spread sheet to relational
tables as Access is intended and that way you can track an infinite number of
movements.

Use a record per movement instead of two fields in a record.

Then just check for the latest date.

--
Build a little, test a little.


"Marge" wrote:

I have an Employee Roster database; one of the tables tracks up to 9
promotions, transfers, reassignments, etc. (called "Movements"), and their
related dates for each employee. Some Movements effect an employee's
evaluation date, where other dates do not effect the evaluation date. The
Movement Dates each have a related true/false field to indicate whether the
employee's evaluation date will change because of the Movement.

Movement Date 1 Evaluation change 1 Movement Date 2 Evaluation change 2
1/25/08 False 3/7/09
True
11/3/07 True 6/5/98
False

With the NZ function I can ask the query to check for the most recent of the
9 Movement Dates or to return the Hire Date if no Movement Date is found:

Eval Date: NZ([movement date 9],NZ([movement date 8],NZ([movement date
7],NZ([movement date 6],NZ([movement date 5],NZ([movement date
4],NZ([movement date 3],NZ([movement date 2],NZ([movement date 1],[T-PD
Roster.hire date])))))))))

What I need to do is to ask the query to check for the most recent of the 9
Movement Dates that have a True Evaluation change field.

I think I need to use an IIF statement to isolate the True dates.

I could really use your help; any assistance will be greatly appreciated.

  #3  
Old November 23rd, 2009, 08:23 PM posted to microsoft.public.access.queries
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Can I use an IIF statement with the NZ function?

And what will you do when the powers-that-be decide to add yet another
"movement"? Or stop considering one of the existing ones?

Your table design is not so much a relational database table as a
spreadsheet. Access is a relational database, and is optimized to work with
well-normalized data.

If you try to feed it 'sheet data, both you and Access will end up working
overtime to come up with work-arounds ... oh wait, that's what you're doing
g!

Before you develop your approach any further, consider brushing up on
"normalization". If your data were better normalized, Access' functions and
features would work easily, without all the extra Nz()s. ... and you
wouldn't need to redesign your tables, queries, forms, reports, etc. each
time there's a change in 'movements'...

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
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 pseudocode 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.

"Marge" wrote in message
...
I have an Employee Roster database; one of the tables tracks up to 9
promotions, transfers, reassignments, etc. (called "Movements"), and their
related dates for each employee. Some Movements effect an employee's
evaluation date, where other dates do not effect the evaluation date. The
Movement Dates each have a related true/false field to indicate whether
the
employee's evaluation date will change because of the Movement.

Movement Date 1 Evaluation change 1 Movement Date 2 Evaluation change 2
1/25/08 False 3/7/09
True
11/3/07 True 6/5/98
False

With the NZ function I can ask the query to check for the most recent of
the
9 Movement Dates or to return the Hire Date if no Movement Date is found:

Eval Date: NZ([movement date 9],NZ([movement date 8],NZ([movement date
7],NZ([movement date 6],NZ([movement date 5],NZ([movement date
4],NZ([movement date 3],NZ([movement date 2],NZ([movement date 1],[T-PD
Roster.hire date])))))))))

What I need to do is to ask the query to check for the most recent of the
9
Movement Dates that have a True Evaluation change field.

I think I need to use an IIF statement to isolate the True dates.

I could really use your help; any assistance will be greatly appreciated.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.