PC Review


Reply
Thread Tools Rate Thread

Date calcutation

 
 
=?Utf-8?B?Sm9zdcOp?=
Guest
Posts: n/a
 
      26th Oct 2007
Good afternoon, i need some help with the following:
I have a maintenace DB, i have the following fields MachineHours (long int),
MaintenaceHours (long int), MaintenaceDate (date) and WeeklyHourWork (long
int). I have a text box NextMaintenace (date) where i calcute the date of the
next maintenace based on the date of the maintenace (MaintenaceDate)
difference between MachineHours, MaintenaceHours and WeeklyHourWork.
example:
if MachineHours=4000, MaintenaceHours=7000, MaintenaceDate=26-10-2007,
WeeklyHourWork=40
then
NextMaintenace=15-03-2009
This works fine but I need to put a limit to this MaintenaceDate so it can´t
be bigger than 1 year (365 days).
I've tried using IF-THEN-ELSE conditions but it didn't work very well.
Can somebody give me a clue how to do this?

Thanks in advance


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGFuY2U=?=
Guest
Posts: n/a
 
      26th Oct 2007
You can find the difference between two dates with the datediff function.

If DateDiff("d", <START_DATE> ,END_DATE>) > 365 then
<Whatever happens when it's greater>
else
<Normal processing>
end if

"Josué" wrote:

> Good afternoon, i need some help with the following:
> I have a maintenace DB, i have the following fields MachineHours (long int),
> MaintenaceHours (long int), MaintenaceDate (date) and WeeklyHourWork (long
> int). I have a text box NextMaintenace (date) where i calcute the date of the
> next maintenace based on the date of the maintenace (MaintenaceDate)
> difference between MachineHours, MaintenaceHours and WeeklyHourWork.
> example:
> if MachineHours=4000, MaintenaceHours=7000, MaintenaceDate=26-10-2007,
> WeeklyHourWork=40
> then
> NextMaintenace=15-03-2009
> This works fine but I need to put a limit to this MaintenaceDate so it can´t
> be bigger than 1 year (365 days).
> I've tried using IF-THEN-ELSE conditions but it didn't work very well.
> Can somebody give me a clue how to do this?
>
> Thanks in advance
>
>

 
Reply With Quote
 
=?Utf-8?B?Sm9zdcOp?=
Guest
Posts: n/a
 
      26th Oct 2007
Thanks Lancem,
Where do I put this code? Before Update or After Update?
i am making the calculation
(=[Maintenacedate]+((([MaintenaceHour]-[MachineHour])/[WeeklyHourWork])*7))
on the control source of the text box, should i change it?

"Lance" escreveu:

> You can find the difference between two dates with the datediff function.
>
> If DateDiff("d", <START_DATE> ,END_DATE>) > 365 then
> <Whatever happens when it's greater>
> else
> <Normal processing>
> end if
>
> "Josué" wrote:
>
> > Good afternoon, i need some help with the following:
> > I have a maintenace DB, i have the following fields MachineHours (long int),
> > MaintenaceHours (long int), MaintenaceDate (date) and WeeklyHourWork (long
> > int). I have a text box NextMaintenace (date) where i calcute the date of the
> > next maintenace based on the date of the maintenace (MaintenaceDate)
> > difference between MachineHours, MaintenaceHours and WeeklyHourWork.
> > example:
> > if MachineHours=4000, MaintenaceHours=7000, MaintenaceDate=26-10-2007,
> > WeeklyHourWork=40
> > then
> > NextMaintenace=15-03-2009
> > This works fine but I need to put a limit to this MaintenaceDate so it can´t
> > be bigger than 1 year (365 days).
> > I've tried using IF-THEN-ELSE conditions but it didn't work very well.
> > Can somebody give me a clue how to do this?
> >
> > Thanks in advance
> >
> >

 
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
what method to use to add 1 day to a date (hotel reservation for one night by clicking on calender) and get it displayed in date formate in a textbox for departure date? Amanda Microsoft VB .NET 2 10th Oct 2006 06:52 AM
Link date to a table with Date Range (Eff Date and term date) =?Utf-8?B?S2V2aW4gUmVlZA==?= Microsoft Access 1 31st Aug 2006 04:23 PM
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
Run Query from date to date, Print the from date to date in the header of the report? Dustin Swartz Microsoft Access Queries 1 25th Jan 2005 07:06 PM
Date fields automatically changing when today date matches date field entry.Help! Brian Cassin Microsoft Access Forms 1 15th Nov 2003 01:51 PM


Features
 

Advertising
 

Newsgroups
 


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