I would like to create a query that would detect the most recent month and would list those records as well as records with dates from the previous 2 months. All dates are end-of-month values. 01/31/07, 12/31/06, 11/30/06, 10/31/06 etc.
I would like to create a query that would detect the most recent month and would list those records as well as records with dates from the previous 2 months. All dates are end-of-month values. 01/31/07, 12/31/06, 11/30/06, 10/31/06 etc.
Put something like the following in the criteria of the date field. Replace both "ex_date" with the field name and "tblDates" with the table name, You might also need to change the -2 to -3. Between DMax("ex_date","tblDates") And DateAdd("m",-2,DMax("ex_date","tblDates")) If you have a lot of records, like in the tens of thousands, the DMax function could be rather slow. I would help if your date field is indexed. -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
Field: YourDateField Criteria: Between DateSerial(Year(Date()),Month(Date())-2,0) And DateSerial(Year(Date()),Month(Date())+1,0) -- John Spencer Access MVP 2002-2005, 2007 Center for Health Program Development and Management University of Maryland Baltimore County .
In article <65E2B6A1-09E9-435C-9D98- XXXX@XXXXX.COM >, XXXX@XXXXX.COM says... maybe something like this would also work (Northwind Query): PARAMETERS [Enter Date:] DateTime; SELECT * FROM Orders INNER JOIN [Order Subtotals] ON Orders.OrderID= [Order Subtotals].OrderID WHERE Orders.ShippedDate Is Not Null And datediff("m", 0,Orders.ShippedDate) between DATEDIFF("m",0,[Enter Date:])-2 And DATEDIFF("m",0,[Enter Date:]) ORDER BY Orders.ShippedDate;
1.Show previous months reading on new months record
Good afternoon, I have been trying to figure out for the last three days now, how I can show the previous months fuel readings on the next months record. I don't know if I've been looking at it too long or what but I've hit a brick wall in trying to get this to work. My tables are: tblFuelTracking FuelId - PK FuelDate Location (10 different locations in all) tblFuelDips DipId - PK FuelId - FK DipMeterDate EndingDipReading EndingDipMeter I've tried subqueries, DLookups and anything else I could think of, but I'm really unclear how I can have my July 31st readings show up when I enter the August 31st readings for the same location. Could someone please give me some quidance on this before I commit myself? Any help would be greatly appreciated. Thanks kindly
2.Sum of Most Recent to Most Recent-12 months
I have been searching around for a week now and I still can't wrap my head around this problem, so any help is greatly appreciated! I have an attendence database, where employees get points when they aren't at work. I am trying to make a query/report that will find the most recent occurance of a point, and then sum the points for the employee from that most recent occurance to 12 months prior. My table looks something like: employee pointdate pointvalue Example Data Set: John 12/05/05 1 John 10/18/05 1 John 08/20/04 1 Desired Result: John's current points = 2 Can anything give me a starting point on how I should approach this? Thanks in advance!
3.Previous 12 months not corrent month.
4.deducting the previous month from the current month
I have a table with the following data month reading Jan 100 Feb 200 mar 300 I need to take the value from a current month and deduct the previous month. This needs to be done for all of the records within the field
5.Display records from previous month
I am trying to create a report that uses records from the previous month. The approach I am attempting is to base the report on a query that has been built to return the records for the previous month. The field name containing the date is Due Date. In the query, I have used DateAdd("m",-1,Date()) as my criteria under the "Due Date" field, but it returns nothing, even though there are two records that should be displayed. So, my questions are: 1) Am I using an incorrect formula? I have tried a few combinations of DateSerial functions, to no success. What would the correct formula be? 2) Am I taking the wrong approach? Should I build that filter directly into the report? Thanks, JL
6. Filter for Previous Month's Records
Users browsing this forum: No registered users and 15 guest