Calculation Based On Date

Aug 29, 2006

I am not sure how to do the following and appreciate any help offered.

I need to have create an expression that gives me a total based on the number of days (different arrival and departure dates) where each day has a different value but remains the same from record to record. Perhaps this is a very easy thing to do, but I am just missing it.

Thank you

View Replies


ADVERTISEMENT

Total Based On Calculation

Nov 20, 2006

Good Day!
I seem to be running into a calculation problem in one of my queries. I have two fields in the query, AdmitDate and DischargeDate. I built in an expression, Exp100 to catculate the date diff in days between these two dates. Now what I want to do is display a count of the grand total days. So, if I have the following three records:

ID AdmitDate DischargeDate Exp100
1..... 01/01/06.........01/15/06............15
2......07/12/06.........07/19/06............7
3......04/27/06.........04/30/06............3

My query should display:
Healthy Plan Total Patients=3
Healthy Plan Total # Days = 25

How can I program this to correctly display this information? Thanks for any help or advice, it would be most welcome at this point. Cheers.

View 10 Replies View Related

Running Calculation Based On Previous Transactions

Jul 12, 2005

I am building an application for a small clinic. In the interests of good database design, I don't want to be storing numbers that are derived by calculation.

A patient with insurance will have a deductable that will be entered into a field on their first (ms access) transaction form.

A calculation will put the remaining deductable into another field. No problem.
However, the NEXT visit has to look back to find previous transaction records, again perform the initial calculation and then perform another for this transaction, and again the next time and the next until the deductable reaches zero.

Additionally, since I'm not storing these values, if I pull up an old transaction form, that form has to re-perform the calculation ONLY on transactions from that date and earlier. It must not reflect visits that took place later.

So, this field must query tblTransactions, filtered by the name of the patient (a combo box called tblTransactions.Patient_Name that looks at tblContacts), the transaction date/time (stored in two date/time fields, cleverly named tblTransactions.Date and tblTransactions.Time), and the total deductable value stored in a field called tblTransactions.Deductable.

As someone who has never coded anything more complicated than DOS batch files, I'm at somewhat of a loss as to how to go about this.

Any assistance, code-wise and which Property value to put it in would be MOST appreciated.

View 1 Replies View Related

Reports :: Calculation Based On Row / Value Selected From List

Dec 8, 2014

I have a table with a primary key as date, and various other fields with numerical values. I also have a query that calculates running totals for each of these fields, as well as including the fields from the table.

I need to create a report or form in which I can select a date(primary key) from a drop down list.

I need the selected date to determine a row/value from a field (a running total from the query)

I then need to use that value in a formula;

result = sum([field]) - value

What I am trying to do is calculate the difference between the sum of a field, and a specific row/value in a calculated field containing a running total of the original field.

View 10 Replies View Related

Major Challenge - Update A Table Based On Calculation

Nov 14, 2004

I am so interested to see a solution to this little problem…i think ithis is one of my more complicated questions!!!!

Problem:

Where I work we have a series of machines… named “ C1, H7, H8 etc”

Each line has 3 counters on it,

Impressions – records the number of cartons used on the line
Standard Pack – records the number of filled cartons with product
Output – records the number of cartons that complete the whole line process and are ready to be shipped to the customer.

Sounds straight forward enough….but the process gets a little more complicated.

Some lines are referred to as joint lines… this indicates that the product from each line the output figure is joined together and totalled. So it is not possible to calculate how many each line completed for the output figure. Note… it is only the Output figure that is joint, each line still has it’s own impressions and standard park counters

Grouped lines are given a group code – P8 in this case.

Example…

C1 not joined

H7 and H8 joined.

C1 –
Impressions –1000 Cartons
Standard Pack – 900 Cartons
Output – 800 Cartons

H7 - P8
Impressions –1600 Cartons
Standard Pack – 1500 Cartons

H8 – P8
Impressions –400 Cartons
Standard Pack – 300 Cartons

P8
Output – 1600 Cartons

The output counter is brought in to the database automatically via a linked spreadsheet and a macro, this data is then stored in a table called “DaycodeMachineShiftImpressions” you will see in this table that the grouping is referred to as Machine.

As previously stated we have no real way of working out the amount each line has output individually.. the way it is calculated at the moment, is to take the figure for P8 and split it into 2 equal figures and assign that to each line.

So in this case the figure assigned to each line would be 800, although you will see that this is not possible for H8 line as it only put 400 cartons on the line in the first place.

I now want to implement the following calculation to my DB,

(see Attached Spreadsheet)

the calculations a re stored in cells b12 & b13 in the spreadsheet.

so that the output figure is separated

in proportion to impressions made.

I then need the figure per line to be fed back to the “tblProduction” output field..

in the tblproduction the data for P8 is stored to line level so in this case as H7 and H8, hence why i want to use the calculation to work out the output figure per line...

Can this be done automatically, if so please help me…

Andy

View 2 Replies View Related

Major Challenge - Update A Table Based On Calculation

Nov 14, 2004

I am so interested to see a solution to this little problem…i think ithis is one of my more complicated questions!!!!

Problem:

Where I work we have a series of machines… named “ C1, H7, H8 etc”

Each line has 3 counters on it,

Impressions – records the number of cartons used on the line
Standard Pack – records the number of filled cartons with product
Output – records the number of cartons that complete the whole line process and are ready to be shipped to the customer.

Sounds straight forward enough….but the process gets a little more complicated.

Some lines are referred to as joint lines… this indicates that the product from each line the output figure is joined together and totalled. So it is not possible to calculate how many each line completed for the output figure. Note… it is only the Output figure that is joint, each line still has it’s own impressions and standard park counters

Grouped lines are given a group code – P8 in this case.

Example…

C1 not joined

H7 and H8 joined.

C1 –
Impressions –1000 Cartons
Standard Pack – 900 Cartons
Output – 800 Cartons

H7 - P8
Impressions –1600 Cartons
Standard Pack – 1500 Cartons

H8 – P8
Impressions –400 Cartons
Standard Pack – 300 Cartons

P8
Output – 1600 Cartons

The output counter is brought in to the database automatically via a linked spreadsheet and a macro, this data is then stored in a table called “DaycodeMachineShiftImpressions” you will see in this table that the grouping is referred to as Machine.

As previously stated we have no real way of working out the amount each line has output individually.. the way it is calculated at the moment, is to take the figure for P8 and split it into 2 equal figures and assign that to each line.

So in this case the figure assigned to each line would be 800, although you will see that this is not possible for H8 line as it only put 400 cartons on the line in the first place.

I now want to implement the following calculation to my DB,

(see Attached Spreadsheet)

the calculations a re stored in cells b12 & b13 in the spreadsheet.

so that the output figure is separated

in proportion to impressions made.

I then need the figure per line to be fed back to the “tblProduction” output field..

in the tblproduction the data for P8 is stored to line level so in this case as H7 and H8, hence why i want to use the calculation to work out the output figure per line...

Can this be done automatically, if so please help me…

Andy

View 5 Replies View Related

Queries :: Query Calculation Based On Current Time

Apr 24, 2013

I have a database that has 2 forms. After submitting the first form, the user should complete the second form within 24 hours. The first form stores the Date/Time the form was submitted. I want to be able to run a query and have a column in the query that is "Time Remaining". In non-technical terms, this column would be: Date/Time form submitted + 24 hours - Current date/time.

View 3 Replies View Related

Calculation Between Start Date & End Date

Jul 18, 2005

I have a form which has a start date field & end date field
i have a query that works out how many days from start date to end date that excludes weekends now my boss wants it to exclude any holidays we may have such as bank holidays etc
can any help me with this
i think i need a module and a new table with all the holidays in it
i am right or iam i going crazy?

View 3 Replies View Related

General :: Meter Reading Table - Calculation Based On Previous Record

Aug 2, 2013

I have a table full of meter readings. I want to have a field called consumption which looks at the reading just entered for that month and then subtracts the previous months reading for that meter which leaves the consumption.

Can I get a formula that can work this out automatically?

View 3 Replies View Related

Date Calculation

Feb 11, 2007

I want to resolve date calculation problem.

I have one form field with users total sum of lenght of service (format of field looks like yy/mm/ddd) in another form field I have data with users date of employment in a firm.
In the third field I want to show total sum of lenght of service (previouse lenght of service and lenght of service in our firm) in format like in first field yy/mm/ddd.

What is a easiest way to calculate a third field in a form.

Thanks in advance !!

View 3 Replies View Related

Date Calculation Help!

Nov 4, 2005

Hi, I have a table that has a start date field, a duration field and an end date field. I was wondering what I need to do so that the end date is calculated and entered when the duration is added onto the start date to produce the end date?

Should the date fields be set as a date, data type?

Sorry if this does not make sense ;)

Many thanks, Tobi

View 1 Replies View Related

Date Calculation

May 31, 2005

Hi Every1

I need sum quick help
I want to pick out the date from my table that is 2 weeks old?
Any ideas how to do this?

thanks

View 11 Replies View Related

Date Calculation

Nov 27, 2007

In my tables i currently have a start date for each employee, in my query i need to single out those who fall after 3rd september 2007, providing a yes/no answer.

View 3 Replies View Related

Date Calculation

Sep 9, 2005

Here is the scenerio:
I have two tables:
tblDate: Contains on Months (i.e.Jan, Feb, Mar, etc)
tblActivities: Contains 4 fields Name, date, activity and hours

I have greated a form that allows me to select what month I want to see. It has a simple combo box in it that point back to tblDate.date. I setup a macro that is doing a OpenReport, there Where Clause is as follows:
[Forms]![frmMnthSelect]![Combo0] Like [tblVolunteers]![Date]

Of course this is not working, and I am at a loss.

I have a Query that is setup that is pulling all records for the current month, but I need to be able to select individual months, because I often have to pull reports for past and future projects.

Can some one start me out in the right direction......

Thanks,
Chuck

View 5 Replies View Related

Excel Date Calculation

Nov 21, 2005

Hrmm, im sure there used to be an Excel forum, i seem to have lost it :/ Hope its ok posting here:

What im trying to do is, for a range of dates from 1/1/2005 to 31/12/2020 get the Qtrly Financial Period before...

So, for instance:

A date of 1/1/2005 makes the period before 1/10/2004 to 31/12/2005
A date of 1/5/2005 makes the period before 1/1/2005 to 31/3/2005
A date of 1/8/2010 makes the period before 1/4/2010 to 30/6/2010

Fiscal Period (for those that dont work with them) are, 1st April to 30th June, 1st July to 30th Sept, 1st Oct to 31st Dec and 1st Jan to 31st March of any year.

So what i want is 3 colums in excel, Column 1 = Period Start, Column 2 = Period End, Column 3 = Date

Can anyone figure the forumla out? Doesnt matter where its done in, just as long as the end result can be in Excel....

View 4 Replies View Related

Date Time Calculation

Apr 9, 2006

Hello friends,

I have a table for "Production Orders" ie. work orders.

there are feilds : start date , start time

based on these feilds i want to calculate the remaining time to start production.

but what i want is

if remaining time is > 1 day then
give results in the format " 1 day and 2 hrs"

elseif remaining time < 1 day then
give result in the format " 2 hrs and 24 mins"

and also current time - remaining time > 0 else result = "N/A"



how can i do this simply

View 2 Replies View Related

Calculation Criteria On Max(date)

Jan 16, 2006

My query selects all those who donated to a fund.The max on the date restricts all but their last donation, working fine.But now I want to list all those who have not donated anything in the last x days (user defined). I want to use Date()- dateField>30 but now it does not let me peform the query.
Any way I can do this in just one query? Thanks!

SELECT main.dgTitle, main.dgInit, main.dgSurname, main.dgNo, main.dgStreet, main.dgShul, Max(main.dgDate) AS maxdate
FROM main
WHERE (((Date()-[main].[dgdate])>30))
GROUP BY main.dgTitle, main.dgInit, main.dgSurname, main.dgNo, main.dgStreet, main.dgShul;

View 4 Replies View Related

Date Across Month Calculation

Jun 21, 2006

Good Morning,

I have a table where I record period of time:
Example:

ID1 from 25-apr-06 to 06-may-06 Holiday
ID1 from 06-may-06 to 02-jun-06 Work

How do I automatically calculate how many days ID1 was on Holiday and how many days was workign in may?

Any help appreciated

Enrico

View 3 Replies View Related

Date / Time Calculation Help

Jul 13, 2006

I'm having trouble getting my head around this.
I have a database that collects stats of patients admitted to ICU.
I have a table PtDataTable (pk = PtID) with a one to many relationship with PtVisitTable (pk = VisitID, fk = PtID). The patient visit table has the fields AdmissionDate and AdmissionTime, and DischargeDate and DischargeTime.
I need to calculate if the patient is readmitted to ICU in less than or equal to 48hrs. In other words calculate the time elapsed between DischargedDate and DischargedTime in one record and the AdmissionDate and AdmissionTime for other records in the PtVisitTable for the same patient.
I'm not sure if I stated this clearly.
Any help is appreciated as always.

View 2 Replies View Related

Date Calculation In Query

Apr 20, 2007

YearsOfService: DateDiff("d",[Employee]![SIV Date],Date())/365

First I'm calculating the current Years of Service. SIV Date = Hired Date

Then I would like to calculate the years of service as of 12/31/"Current Year", where the Current Year would not require updating every year and 12/31 would be constant.

I'm just not sure how to specify the Month/Day and use Current Year not hard coded. I could set up a user defined date for that half of the calc but my users are not really bright and allowing them to simply click a button is my only option there.

Ultimately I will compare the 2 years of Service numbers to determine if there will be a change in the level of vacation accrual an individual receives during the year. The only part I have issue with is coding that date. Thanks for the help.

View 2 Replies View Related

Review Date Calculation

Aug 28, 2007

Hi
I have a database for maintaining procurement contracts which includes a start date for each contract and a frequency of reviews required (monthly, qrtly, bi-annual, yearly). I need to be able to generate a report that will tell me when the next review is due for each contract, taking today's date into consideration.

This is the setup so far:

tblRegistry - contains field 'Commence' for the start date of the contract and 'Review Req' to indicate how often a review is required (monthly, yearly etc).

tblReviewReq - contains field 'Review Frequency' (monthly, yearly etc) and 'Days' to assign the number of days eg monthly = 30, yearly = 365 etc.

Next I have a query that includes the above tables using the fields 'Commence' and 'Days' and have created a calculated field to give me the next review date ie contract start is 1/08/07, review freq is monthly (=30 days), therefore the next review is 1/09/07. "NextReview:[Commence]+[Days]"

But how do I get it to tell me the next review date after the 1/09/07? Ultimately I'd like to be able to pull a report at any stage which will tell me all the reviews that are coming up.

Thanks

View 3 Replies View Related

Date & Time Calculation

Dec 19, 2007

Table
------
I have one field called [Time] in dd-mm-yyyy hh:mm format in table A.

I have another field called [Deadline] in text format (Mon 10:00) in table B.

Queries
-------
Need to build one queries that have the above two field, but with additional field called [PullDeadline] that the [Time] will look out the [Deadline] and return the actual time & date value in [PullDeadline]. No matter how the [Time] change, the [PullDeadline] will stick to [Deadline] and return the value in that particular week.

For example,

[Time] = 01-12-2007 05:00:00 AM
[Deadline] = Mon 10:00
[PullDeadline] = 26-11-2007 10:00 AM

How to handle, if the deadline is previous or next week?

Eg. [Deadline] = Sun 10:00

Then [PullDeadline] = 25-11-2007 10:00 AM instead of 02-12-2007 10:00 AM.

View 5 Replies View Related

Forward Date Calculation

Mar 10, 2008

I need to use an update query to calculate the following 1st of April for each of 3000+ records, the only exception is if the Start Date is the 1st of April in which case the date will remain the same.

Examples

StartDateAdjStartDate

01/03/08 01/04/08
10/09/06 01/04/07
15/04/08 04/04/09
01/04/08 01/04/08

Can anyone advise the best way to do this?

Regards

Hawk

View 3 Replies View Related

Variable In A Date Calculation

Aug 14, 2005

I have the following date calculation :
-----------------
Private Sub StatofLimits_GotFocus()
'--Determines Statute of Limitations accounting for minors.
If DateAdd("yyyy", 18, Me.Txt14) > Me.txtBegin Then
Me.StatofLimits = DateAdd("yyyy", 20, Me.Txt14)
Else
Me.StatofLimits = DateAdd("yyyy", 2, Me.txtBegin)
End If
End Sub
------------------------
Here is my problem. The number "2" in the else statement (Me.StatofLimits = DateAdd("yyyy", 2, Me.txtBegin)in the above example is a variable. The variable is selected from a combobox and stored in an unbound textbox. The variable will always represent a number of years-ie 3 years, 4 years, etc. I need to modify my calculation so that it will pull the variable from my textbox:
I know this isn't correct but this is what I need:

Me.StatofLimits = DateAdd("yyyy", (Number from MyTxtBox), Me.txtBegin)



Can anyone give me the correct syntext?

Pat, If you read this, I did listen. The reason I need to modify my calculation and use a variable is because I moved my Statute of Limitation Dates to the same table and different case types have different Statutes. They can be anywhere from 2 to 6 years.

View 4 Replies View Related

Time And Date Calculation

Oct 15, 2006

OK so I have a form with the following fields which are all date/time type
apptTime
timerOn
pickupDate
reminder - combo box with 1 hour, 2 hour...etc up to 10 hours

so what happens is when user enters apptTime say 18:30 with pickupDate set for current days date 10/14/2006 then chooses 2 hours from the reminder combo. This then sets timerOn to (apptTime-2 hours) so it is 16:30. I have set a conditional formatting to change background color when "timerOn<=Time() and pickupDate=Date()" so user knows to dispatch this load. This all works great until you get to midnight.
If user sets apptTime to 00:30 with pickupDate to 10/15/2006 and chooses 2 hour reminder, so timerOn does get set to 22:30 and you would expect the conditional formatting to work once the current Time() is 22:30, but since the current Date() is 10/14/2006, the expression is false. I have tried the DateAdd such as DateAdd("d", 1, Date()) command in various ways but can't get it to work for "timerOn<=Time() and pickupDate=DateAdd("d", 1, Date())"...I mean it works because it adds 1 day to pickupDate and condition is then true, but it ignores the timerOn<=Time() part and formats even if I reset system time to 22:29. Can anybody give me insite on where the logic is wrong?

View 1 Replies View Related

Using Nz Function In A Date Calculation

Apr 2, 2008

Must admit I have always had problems getting my mind around the Nz function and where to stick it in an expression. have googled this one (as I know it is not a common problem) but to no avail

If i have a calculated field

=DateAdd("d",7,[DateSubmitted]) then how do I deal with the possibility that [DateSubmitted] may be blank??

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved