473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Evaluating dates that contain nulls

I am trying to evaluate the latest occurence of a date which will go
in the field titled eligibility date. Table is set up as follows and
am using update query to update the eligibility date to the latest of
hire,award, or accident)

Emp Hire Date Accident Date Award Date eligibility
Date
Hire Date is never a null, however if there are no accidents or awards
those respective fields will be null. I tried using if and max
statements but to no avail. Any suggestions
Nov 12 '05 #1
2 1727
"Steve" <sv*******@msn.com> wrote in message
news:2d**************************@posting.google.c om...
I am trying to evaluate the latest occurence of a date which will go
in the field titled eligibility date. Table is set up as follows and
am using update query to update the eligibility date to the latest of
hire,award, or accident)

Emp Hire Date Accident Date Award Date eligibility
Date
Hire Date is never a null, however if there are no accidents or awards
those respective fields will be null. I tried using if and max
statements but to no avail. Any suggestions


Try Nz() function.

1. Or better still, change your table structure. I'm not sure what the exact
purpose of this database is, but does each employee only have zero or one
accidents? Probably not.

So I think you need a table of accidents, joined many to one to employee, on
the Emp field.

2. If Eligibility is just the maximum of Hire Date, Accident Date, and Award
Date, then that's 'derived data'. Meaning you can work it out from the data
you've got. So you don't need to do an update query, because you shouldn't
be storing eligiblity date atall.

Mike

Nov 12 '05 #2
Thanks for the feedback Mike. I need elgibility date because there
are calculations that need to know how many hours has someone worked
after their elibility date which changes if they have been given an
award or were in a accident. I am just struggling to come up with it
because of the nulls. I wish it wer in excel then it a simple
solution!

"Mike MacSween" <mi******************@btinternet.com> wrote in message news:<3f***********************@pubnews.gradwell.n et>...
"Steve" <sv*******@msn.com> wrote in message
news:2d**************************@posting.google.c om...
I am trying to evaluate the latest occurence of a date which will go
in the field titled eligibility date. Table is set up as follows and
am using update query to update the eligibility date to the latest of
hire,award, or accident)

Emp Hire Date Accident Date Award Date eligibility
Date
Hire Date is never a null, however if there are no accidents or awards
those respective fields will be null. I tried using if and max
statements but to no avail. Any suggestions


Try Nz() function.

1. Or better still, change your table structure. I'm not sure what the exact
purpose of this database is, but does each employee only have zero or one
accidents? Probably not.

So I think you need a table of accidents, joined many to one to employee, on
the Emp field.

2. If Eligibility is just the maximum of Hire Date, Accident Date, and Award
Date, then that's 'derived data'. Meaning you can work it out from the data
you've got. So you don't need to do an update query, because you shouldn't
be storing eligiblity date atall.

Mike

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: smcgouga | last post by:
Visual Basic 6. ADO 2.8 I have an as400 DB2 V5R1 datasource. Dates are defined as *ISO format and have a range from '0001-01-01' to '9999-12-31'. I am trying to update a date field on the...
6
by: Jordan | last post by:
I'm working with a Repeater using a custom function inside the <itemtemplate> to return a text string. The parameters SHOULD be (DateTime, DateTime, Int16) but the difficulties in getting DateTimes...
6
by: Rookie Card | last post by:
I know this is a very common issue but cannot find a thread that resolves the issue. I need to re-format my dates to "MMM d, yyyy". The problem I have is I have an MSSQL database that allows...
13
by: **Developer** | last post by:
I need to sort the columns of a ListView. Some columns contain dates and others contain integers. What I did once before is in the Compare method I tried date and if that failed I did...
18
by: PC Datasheet | last post by:
An Access user saw my name in a newsgroup and sent me a request for help on a project. As part of the project, a list of the dates in a month was needed. For anyone needing a list of dates in a...
5
by: AAJ | last post by:
Hi Does anyone know of any good publically available set of standards for managing dates when dealing with a database server (in my case SQL Server 2000 and c# VS2005). At the moment, if I...
5
by: M Skabialka | last post by:
I am creating my first Visual Studio project, an inventory database. I have created a form and used written directions to add data from a table to the form using table adapters, data sets, etc. ...
8
by: Phil Stanton | last post by:
I am being thick. I have a table of employees - EmpID & EmpName I have a table or wage rates for each employee - RateID, EmpID, WageRate RateFron (Date) I have a table of payments - PayID,...
2
by: paulquinlan100 | last post by:
Hi I'm trying to execute the following code: sSQL = "insert into lkpChanges (SiteRef,ProjectName,InvestmentType,FieldChanged,PreviousDate,NewDate,ChangeDate,CurrentRelaunch) " & _ "values ("...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.