PC Review


Reply
Thread Tools Rate Thread

Advanced Problem: How Do I Make a, Multiple Date, Date Counter

 
 
Sgt Gordon
Guest
Posts: n/a
 
      30th Nov 2007
I have a database that I track the course of Military Courts. I have to be
able to track, in number of days, the how long the case has gone and stop on
another date. The Fields are:

1. Date Charges were Preferred
2. Date Entered Pretrial Restraint
3. Date Entered Pretrial Confinement
4. Date of Arraignment
5. Date of Trial

I need it to be able to pick the earliest date from 1, 2, 3, and calculate
the number of days (what day it is on) till the date of 4 and another to the
date of 5.

 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      30th Nov 2007
From your description, you have a ... spreadsheet!

If you were limited to using Excel (or some other spreadsheet), you'd
probably end up using "repeating columns" (date of x, date of y, date of z).
But Access is a relational database, and you will not get the best use of
its relationally-oriented features and functions if you feed it 'sheet data.

If you want to find the "earliest date" (i.e., Minimum) from a set of dates
in Access, you need to have them in a single field, separate records, not
separate fields, one record.

Is there a reason you aren't using Excel?

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Sgt Gordon" <(E-Mail Removed)> wrote in message
news:55185855-7654-4F1C-8239-(E-Mail Removed)...
>I have a database that I track the course of Military Courts. I have to be
> able to track, in number of days, the how long the case has gone and stop
> on
> another date. The Fields are:
>
> 1. Date Charges were Preferred
> 2. Date Entered Pretrial Restraint
> 3. Date Entered Pretrial Confinement
> 4. Date of Arraignment
> 5. Date of Trial
>
> I need it to be able to pick the earliest date from 1, 2, 3, and calculate
> the number of days (what day it is on) till the date of 4 and another to
> the
> date of 5.
>



 
Reply With Quote
 
Lance
Guest
Posts: n/a
 
      30th Nov 2007
To get the earliest date of the 3 fields you can use nested iif statements,
like this:

IIf(MY_TABLE!Preferred<MY_TABLE!Restraint And
MY_TABLE!Preferred<MY_TABLE!Confinement,MY_TABLE!Preferred,IIf(MY_TABLE!Restraint<MY_TABLE!Confinement,MY_TABLE!Restraint,MY_TABLE!Confinement))

You can then use that in conjunction with the datediff function to determine
how many days it's been.

The SQL would look something like:

SELECT MY_TABLE.ID, IIf(MY_TABLE!Preferred<MY_TABLE!Restraint And
MY_TABLE!Preferred<MY_TABLE!Confinement,MY_TABLE!Preferred,IIf(MY_TABLE!Restraint<MY_TABLE!Confinement,MY_TABLE!Restraint,MY_TABLE!Confinement))
AS EARLIEST_DATE, DateDiff("d",[EARLIEST_DATE],[Trial]) AS DAYS_TO_TRIAL,
DateDiff("d",[EARLIEST_DATE],[Arraignment]) AS DAYS_TO_ARRAIGNMENT
FROM MY_TABLE;

You would obviously need to adjust the table and field names to match what
your database contains.



"Sgt Gordon" wrote:

> I have a database that I track the course of Military Courts. I have to be
> able to track, in number of days, the how long the case has gone and stop on
> another date. The Fields are:
>
> 1. Date Charges were Preferred
> 2. Date Entered Pretrial Restraint
> 3. Date Entered Pretrial Confinement
> 4. Date of Arraignment
> 5. Date of Trial
>
> I need it to be able to pick the earliest date from 1, 2, 3, and calculate
> the number of days (what day it is on) till the date of 4 and another to the
> date of 5.
>

 
Reply With Quote
 
Sgt Gordon
Guest
Posts: n/a
 
      30th Nov 2007
Well there are more fields then just those. Those were just the fields that
were part of the problem. I have to track Name, Unit, Charges, Timelines,
Actions, Punishments. All this information on each case and then all that
data has to be able to be sorted each way and then sorted by multiple fields.


I have a 120 Clock on here that I run to tell the lawyers you are on this
date and that at 120 the case will be dropped.

We used to use Spreadsheets but you can not see single files (Forms) and
then click and automatically generate a report with all the file that pertain
to this, that, or the other thing. Also we have multiple clerks generating
data from four locations and with Spreadsheet one person can only use it at a
time but with ours multiple clerks can be working and then the next second I
can generate a report from three or four locations.

"Jeff Boyce" wrote:

> From your description, you have a ... spreadsheet!
>
> If you were limited to using Excel (or some other spreadsheet), you'd
> probably end up using "repeating columns" (date of x, date of y, date of z).
> But Access is a relational database, and you will not get the best use of
> its relationally-oriented features and functions if you feed it 'sheet data.
>
> If you want to find the "earliest date" (i.e., Minimum) from a set of dates
> in Access, you need to have them in a single field, separate records, not
> separate fields, one record.
>
> Is there a reason you aren't using Excel?
>
> Regards
>
> Jeff Boyce
> Microsoft Office/Access MVP
>
> "Sgt Gordon" <(E-Mail Removed)> wrote in message
> news:55185855-7654-4F1C-8239-(E-Mail Removed)...
> >I have a database that I track the course of Military Courts. I have to be
> > able to track, in number of days, the how long the case has gone and stop
> > on
> > another date. The Fields are:
> >
> > 1. Date Charges were Preferred
> > 2. Date Entered Pretrial Restraint
> > 3. Date Entered Pretrial Confinement
> > 4. Date of Arraignment
> > 5. Date of Trial
> >
> > I need it to be able to pick the earliest date from 1, 2, 3, and calculate
> > the number of days (what day it is on) till the date of 4 and another to
> > the
> > date of 5.
> >

>
>
>

 
Reply With Quote
 
KARL DEWEY
Guest
Posts: n/a
 
      30th Nov 2007
Following on what Jeff Boyce said you need two table in a one-to-many
relationship. Use a form and subform to view and edit the data.
The one side of the set would have CaseID (primary key), Name, Unit,
Charges, Timelines, Actions, Punishments, etc. The second table, many side
of the relation, CaseAction, ActionType, and ActionDate.
You could have another table for the ActionTpye with records like this --
Charges Preferred
Pretrial Restraint
Pretrial Confinement
Arraignment
Trial Start/Resume
Trial Postponement
Trial End
Punishment Begin
Punishment End
In the subform have combox/listbox to pick an action.
--
KARL DEWEY
Build a little - Test a little


"Sgt Gordon" wrote:

> Well there are more fields then just those. Those were just the fields that
> were part of the problem. I have to track Name, Unit, Charges, Timelines,
> Actions, Punishments. All this information on each case and then all that
> data has to be able to be sorted each way and then sorted by multiple fields.
>
>
> I have a 120 Clock on here that I run to tell the lawyers you are on this
> date and that at 120 the case will be dropped.
>
> We used to use Spreadsheets but you can not see single files (Forms) and
> then click and automatically generate a report with all the file that pertain
> to this, that, or the other thing. Also we have multiple clerks generating
> data from four locations and with Spreadsheet one person can only use it at a
> time but with ours multiple clerks can be working and then the next second I
> can generate a report from three or four locations.
>
> "Jeff Boyce" wrote:
>
> > From your description, you have a ... spreadsheet!
> >
> > If you were limited to using Excel (or some other spreadsheet), you'd
> > probably end up using "repeating columns" (date of x, date of y, date of z).
> > But Access is a relational database, and you will not get the best use of
> > its relationally-oriented features and functions if you feed it 'sheet data.
> >
> > If you want to find the "earliest date" (i.e., Minimum) from a set of dates
> > in Access, you need to have them in a single field, separate records, not
> > separate fields, one record.
> >
> > Is there a reason you aren't using Excel?
> >
> > Regards
> >
> > Jeff Boyce
> > Microsoft Office/Access MVP
> >
> > "Sgt Gordon" <(E-Mail Removed)> wrote in message
> > news:55185855-7654-4F1C-8239-(E-Mail Removed)...
> > >I have a database that I track the course of Military Courts. I have to be
> > > able to track, in number of days, the how long the case has gone and stop
> > > on
> > > another date. The Fields are:
> > >
> > > 1. Date Charges were Preferred
> > > 2. Date Entered Pretrial Restraint
> > > 3. Date Entered Pretrial Confinement
> > > 4. Date of Arraignment
> > > 5. Date of Trial
> > >
> > > I need it to be able to pick the earliest date from 1, 2, 3, and calculate
> > > the number of days (what day it is on) till the date of 4 and another to
> > > the
> > > date of 5.
> > >

> >
> >
> >

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      30th Nov 2007
On Fri, 30 Nov 2007 09:44:00 -0800, Sgt Gordon
<(E-Mail Removed)> wrote:

>I have a database that I track the course of Military Courts. I have to be
>able to track, in number of days, the how long the case has gone and stop on
>another date. The Fields are:
>
>1. Date Charges were Preferred
>2. Date Entered Pretrial Restraint
>3. Date Entered Pretrial Confinement
>4. Date of Arraignment
>5. Date of Trial
>
>I need it to be able to pick the earliest date from 1, 2, 3, and calculate
>the number of days (what day it is on) till the date of 4 and another to the
>date of 5.


Not knowing anything about military court procedures, this may be an
irrelevant question but... what if there are other dates? Date of pretrial
hearing? Date of first continuation? Date of third continuation?

A better design would be to have a Case table related one-to-many to a
CaseEvents table; instead of one *field* for each event pertaining to a case,
you could have one *record*, with fields for CaseNumber, EventDate, and
EventType. With this design a simple self-join query can get you the time
elapsed between any pair of dates.

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Howw can I make a function return a date in date format Jan Kronsell Microsoft Excel Programming 12 21st Jan 2010 04:24 PM
::: Date Comparison Problem or Date Formula or Date Macro ::: infojacques@gmail.com Microsoft Excel Discussion 3 13th Jul 2007 10:08 AM
i have two date fileds Opend date Due date, can i set default on due date so, its always = to open date on my data entry form1 Urgent Mike Saifie Microsoft Access Form Coding 1 9th Mar 2006 01:08 AM
Make date change in excel to current date when opening daily? =?Utf-8?B?amFtaWU=?= Microsoft Excel Misc 3 1st Mar 2006 03:37 PM
Make sure end date is one year greater than start date AimeeK Microsoft Access Forms 8 15th Nov 2005 12:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:44 AM.