473,396 Members | 1,966 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,396 software developers and data experts.

Report / Query : Multiple Dates

Hi All,

I am trying to create a report but having problem with the critiera
selection logic, please help.

I have the following fields

date1
date2
date3
date4
date5

When the supplier acknowlegee and order the intial supplier order ready date
goes into date1 and balance 4 dates remians blank

Later If the order is late or brought forward the date2 colum is filled in

Later if the order is further late the date3 colum is filled in and date4
and date5 remains blank.

At the end hte order gets shipped.

What I am trying to do is generate a report which check the current date vs
the date1 (if date2 to date5 are blank)

or Date2 (assuming date2 is filled in)

Or date3 if 3rd date is entered

and genrate a report of order which were due to ship today or before today's
date.

Please help.

Regards, Irfan.
Nov 13 '05 #1
5 3489
If you just want to report any record that has any of the dates after today,
create a query, and in the Criteria row under Date1, enter:
Date() Then on the *next* criteria row under Date2 (i.e. the next line down, below
the first Critiera row), enter: Date() Repeat for the other date fields, using a separate criteria row for each
one.
In SQL View, the query will include this clause:
WHERE (([Date1] > Date())
OR ([Date2] > Date())
OR ([Date3] > Date())
OR ([Date4] > Date())
OR ([Date5] > Date()))

If you need to select which of several dates is the most recent one, grab
the MaxOfList() function from this page:
http://members.iinet.net.au/~allenbrowne/func-09.html
To use it type something like this into the Field row of your query:
MaxOfList([date1], [date2], [date3], [date4], [date5])
Then in the Criteria row under this, enter: Date()
The best solution might be to create a related table with fields for:
ID foreign key (which record this relates to)
DelayTypeID which kind of delay
DelayDate the now predicted delay.
Now you only have one date field to search to get the latest date. Typically
that would involve a subquery. More info:
http://support.microsoft.com/?id=209066

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Irfan" <ir**@emirates.net.ae> wrote in message
news:cb**************************@posting.google.c om... Hi All,

I am trying to create a report but having problem with the critiera
selection logic, please help.

I have the following fields

date1
date2
date3
date4
date5

When the supplier acknowlegee and order the intial supplier order ready
date
goes into date1 and balance 4 dates remians blank

Later If the order is late or brought forward the date2 colum is filled in

Later if the order is further late the date3 colum is filled in and date4
and date5 remains blank.

At the end hte order gets shipped.

What I am trying to do is generate a report which check the current date
vs
the date1 (if date2 to date5 are blank)

or Date2 (assuming date2 is filled in)

Or date3 if 3rd date is entered

and genrate a report of order which were due to ship today or before
today's
date.

Please help.

Regards, Irfan.

Nov 13 '05 #2
You need to redesign your table into a normalized form such as:
TblShipDate
ShipDateID
OrderID
DateShipDateChanged
ShipDate

Then all you need is a totals query that finds the max ShipDate for an
OrderID. Or if you want to know how many times it has been chnaged, you need
a totals query that finds the Count of ShipDates for an OederID.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Irfan" <ir**@emirates.net.ae> wrote in message
news:cb**************************@posting.google.c om...
Hi All,

I am trying to create a report but having problem with the critiera
selection logic, please help.

I have the following fields

date1
date2
date3
date4
date5

When the supplier acknowlegee and order the intial supplier order ready date goes into date1 and balance 4 dates remians blank

Later If the order is late or brought forward the date2 colum is filled in

Later if the order is further late the date3 colum is filled in and date4
and date5 remains blank.

At the end hte order gets shipped.

What I am trying to do is generate a report which check the current date vs the date1 (if date2 to date5 are blank)

or Date2 (assuming date2 is filled in)

Or date3 if 3rd date is entered

and genrate a report of order which were due to ship today or before today's date.

Please help.

Regards, Irfan.

Nov 13 '05 #3
Interesting table structure - what happens if an order is delayed more than 4 times? Will you just overrwite the value in date5? You'd probably have been better off with a structure like:

[Date/Time of Estimation], [Estimated Date of Delivery]

that you could then just add records to as required.

Be that as it may, in answer to your specific question, you are going to need to set up a query with a column that looks like this:

LatestDate: iif([Date5] Is Null, iif([Date4] Is Null, iif([Date3] Is Null, iif([Date2 Is Null], [Date1], [Date2]), [Date3]), [Date4]), [Date5])

You can then use this query to select records where [LatestDate] <= Now, although I can never remember whether you need to explicitly strip out the Time bits of Now to turn it into a Date/Time as at midnight...

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #4

Hi, Thanks all for a quick response, at this stage I am using David
Seeto's purposed function of latest date and it is working fine execpt a
small problem.

If I have inputted only first date, the latest date shows blank.

I have listed the code below

LatestDate: IIf([5thDelivery] Is Null,IIf([4thDelivery] Is
Null,IIf([3rdDelivery] Is Null,IIf([EHOUPDelDate Is
Null],[EHODelDate],[EHOUPDelDate]),[3rdDelivery]),[4thDelivery]),[5thDel
ivery])

Please help.

Thanks, Irfan
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
>If I have inputted only first date, the latest date shows blank.
...
LatestDate: IIf([5thDelivery] Is Null,IIf([4thDelivery] Is Null,
IIf([3rdDelivery] Is Null,IIf([EHOUPDelDate Is Null],[EHODelDate],
[EHOUPDelDate]),[3rdDelivery]),[4thDelivery]),[5thDelivery])


Odd - I didn't see those other replies to your question when I first posted... maybe it's because I read these forums through AccessMonster.com?

Anyway, I can't see anything wrong with your formula, assuming that you date fields are:
1. EHODelDate
2. EHOUPDelDate
3. 3rdDelivery
4. 4thDelivery
5. 5thDelivery

Can you post a few records from your table, including some that work and some that don't?

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #6

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

Similar topics

5
by: Jim Fox | last post by:
I have a report that I created that has no data, just boxes, lines and one date field not tied to anything. Basically this report will just print pages according to the dates you entered. Then...
6
by: BlackFireNova | last post by:
Using Access 2002 I am writing a report which draws data from several different tables. I can't link all the tables in a query, as some can not be related without truncating the data. I plan...
2
by: dixie | last post by:
I have a report which is printed daily. It is a list of people. A person can be put on this list for one day, which is easyily achieved from a simple form. My problem is that a person can also...
8
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
2
by: Arnold | last post by:
Greetings Gurus, In a report showing the names of students and their progress, I am getting an error in the name field (Name: #Error). The report gets its data from an unbound form containing...
2
by: DAHMB | last post by:
I have a column in a report that I want to return a sum of certain criteria from a query between two dates. I set the dates in a form that I launch the report from. My query contains a field...
1
by: DAHMB | last post by:
I have a column in a report that I want to return a sum of certain criteria from a query between two dates. I set the dates in a form that I launch the report from. My query contains a field called...
1
by: Dale | last post by:
Access 2003 I am trying to figure out how to develop a report that will display students in 1st column, dates across the top, and "P" or "A" for the data. I have a crosstab that displays what I...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.