Sorry the title dosen't make much sense, can't come up with a good title. Here's the problem, I work in a hospital and I have a program that store patient's admit date and discharge date. My concern is, I need to calcuate patient days (the amount of days the patient stay in the hospital). Let's say a patient was admitted on Jan 15th and discharged on March 20th. So I need to build a query that capture the months, let's say I do it on Feb, how can I tell that this patient was here on Feb? since I have admit date and discharge date. Thanks
eg. we have 4 patients John Smith, Ortiz Prerez, Jim Johnson and Nancy Cruz and we are running the query for Feb.
ID Name AdmitDate Discharge Date "The result should be"
1 John Smith 1/2/07 1/26/07 24 patient days
2 Ortiz Perez 1/27/07 3/4/07 28 patient days (because this user was in the unit)
3 Jim Johnson 12/25/06 Null 28 patient days because of Feb month
4 Nancy Cruz 2/14/07 4/1/07 14 patient days
I need a formula or a function that will return a person's age in years and months. All the functions and formulas that I have seen to date and that I have used only calculate a person's age in years. Can anyone help?
Have a crosstab query for a running 12 months that is used for a report and I noticed today that each month is correct except that it is also picking up Feb of last year as well as this year. All other months are good. No other pre-queries have any date ranges in them. Anyone know what I have to do to prevent this problem? Below is my SQL.:confused:
TRANSFORM Sum([92660ScorecardUnionName].Hrs) AS SumOfHrs SELECT [92660ScorecardUnionName].EMPID, [92660ScorecardUnionName].Category, [92660ScorecardUnionName].OPID, [92660ScorecardUnionName].NAME, [92660ScorecardUnionName].Description, Avg([92660ScorecardUnionName].Hrs) AS [Avg Of Hrs] FROM 92660ScorecardUnionName GROUP BY [92660ScorecardUnionName].EMPID, [92660ScorecardUnionName].Category, [92660ScorecardUnionName].OPID, [92660ScorecardUnionName].NAME, [92660ScorecardUnionName].Description PIVOT Format([Date],"mmm") In ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug',' Sep','Oct','Nov','Dec');
i have to process 3 upcoming months bills .. say i want to show in query like this bill for Nov, Dec, Jan based on the issue date i mentioned earlier and the months to be find from the numeric month field like 3 i mentioned which mean 3 months ahead from issue date.
I want to create a simple query from a list of orders dating back over 12 months.
The fields I have is Ord_Date, Qty
I need to show the orders by month for the last 12 months.
The problem I am getting is that the orders for the month of April (as we are in April now) contain orders from 1st - 22nd April 2013 and orders from 23rd - 30th April 2012, therefore confusing the figures.
I would just like orders grouped by month with a total qty dating back 12 months, but without any old orders for the current month.
I have a variable cost that is a calculated field (as in the colum only exists in a query not as a colum in a table) that is variable hours * variable rate....the problem is ppl at my company sometimes dont know how the costs are goign to be broken down so they only put a Variable Cost....
and since they dont know the rate and hours my calculated field returns nothing...
how can i accomplish this, VBA might seem the way to go but i don't know how to use it for Access.....
so basically i need to calcualte the variable cost only if they enter something in var hours and var rate...other wise the var cost should just be what the users type ( so i i guess i have to make Var Costs a column in the table to give users the option of entering it)
I have a query that has 11 dates on it, I am trying with iif statements to get it down to one column reflecting the most recent date out of the 11, for example 5/2/14 and 4/9/14, I would want to have 5/2/14. The problem with this is that most of the cells are empty and and I can't calculate empty date cells. my thought was to create a statement that goes something like this iif([Date1]="", "1", [date1]), obviously this does not work but I would like for it to show something other then nothing so that I can calculate on it.
I want to Count the amount of not treated improvements after 1 month in a report. The rules will be if the improvement cell is empty one month after the date the improvement is registered, then it should be counted.
I have an birthday report for the current month (august) and would like to make a button on the report that can calculate next month (september) and shows birthdays for that month. how to calculate next month?
Is there a way to take today's date and calculate the last day of the last month? Without the user needing to enter any parameters. In other words, if I ran the query today with this criteria, it would only show information for April 30, 2013. Is that possible?
I've been trying to solve this problem for the past month and at the verge of destroying my PC! I've trawled through numerous web sites but just cant seem to figure this one out.I'm trying to get access to tell me what the next service moth is based on the start date, end date, and the frequency of service.
For example:
Start date: 01/01/2014 End date: 31/12/2015
service frequency: Every 4 months
Using the above information the service months are: 1 - April 2014 2 - August 2014 3 - December 2014 4 - April 2015 5 - August 2015 6 - December 2015
I want to build a query that calculates the fiscal year and the month from a date on-the-fly. I tried to do it in VBA, but it's more complicated than in query I guess. So this is my table:
The date is on the left, in the middle I want to have calculated Jan 14 and on the right I want 14/15.
In VBA I started with this: strMonth = MonthName(Month(A), True) & " " & Format(A, "YY") which gave me "Jan 08". But the date was hard-coded and not from my table. Then I tried to store the information by SQL statement into a string. But this also didn't work, the types were different.
Code: UPDATE tblSAPOD SET sapOD_month = Year([sapOD_OrderDate])-IIf([sapOD_OrderDate]< DateSerial(Year([sapOD_OrderDate]),6,16),1,0) WHERE sapOD_OrderDate Like "*/*/94";
.. but I guess it's wrong, it gives me a syntax error.
I have written a user defined function that calculates the end of the current month. This I named EndOfThisMonth. It works well as a function. Now I would like to use it as date criteria to include in a query. The function is included as such EndOfThisMonth().
The field on which this function is to enter as a criteria is another calculated date function called Due.
When I run this query I get an error message saying Undefined Function 'EndOfThisMonth' in expression.
I currently have a form where users can enter an "End Date", click a button, and it queries the data from 12 months prior to "End Date" entered.
Is there a way to force the query to show all 12 months, even if there are no records for a particular month? For example: if the user enters February 2013 in the date field, I would like the query to return:
March 2012 April 2012 May 2012 June 2012 July 2012 August 2012 September 2012 October 2012 November 2012 December 2012 January 2013 February 2013
...so even if June 2012 has no records, it is included in the query with a value of zero.
This is what I have so far:
WHERE (((Qry_Tbl_Assets.Dte) Between DateAdd("m",-12,[Forms]![Main_screen]![End_Date]) And [Forms]![Main_screen]![End_Date]))
I am trying to create a database that will keep track of the orders placed for a given part number by month. Currently, my table houses the part number, and the ordered amount for the past three years by month (there are thirty-five columns for every part). My column headings are ORDER_MAY_2013, etc. I would like to set a query up that will look at the column headings and pull the amounts ordered for each part for the past twelve months. In other words, I have three years of data in my table. In my query, I just want one year. However, I don't want to have to rewrite the query every month so that it will pick up the new data. Is there a way to accomplish this?
Is there a better way to build this database? I thought about just have four columns in my table - PART_NUMBER, ORDER_MONTH, ORDER_YEAR, ORDER_AMOUNT. The only problem there, is that every part (there are about 450 parts) would have to be listed 35+ times. That seemed too redundant to me, so I built the table this way. However, now I am having trouble querying against it.
I have a table full of dates of meetings through out the year...
Example
tMeetingDates
16th August 2005 18th September 2005 19th October 2005 23rd November
-----
i also have a report that i print out each month that has the date of the meeting on it... i currently edit the date manually.
I was wondering if there was a way to automate this facility, so that the report looked to the table of dates and looked for the current Months Date that is stored i the table.
i then want this date to be displayed in the Report.
So in this instance if i am running a report for tomorrows meeting being the 19th October it would display that date in the report....regardless of when i run the report...
Obviously if i run the report on the first of November because the month has changed it would then display the date of the November Meeting...
Using Access 2010..I have form with a date on it. For this control I have show date picker set to "For dates" and lo and behold I get calendar! I can scroll through this calendar month by month. Great if I just want to go back or forward a month or three. What I'd like to be able to do is scroll through the calendar year by year. Can I do this with the method I'm using at the moment? If not is there a way round it that isn't over complicated?