Queries :: Displaying All Dates Within A Month

Oct 14, 2014

I have created a query to limit the list in a combo box to display the months and years of the date field in a table. Below is the code that I am using. This works fine except this displays the years within the months - for example:

January 2012
January 2013
January 2014
February 2012
March 2012
March 2014
April 2012
May 2012
May 2014

I would much prefer it to sort by month and year:

January 2012
February 2012
March 2012
April 2012
May 2012
January 2013
January 2014
March 2014
May 2014

Code:
SELECT DISTINCT Month([QTDate]) AS MoNum, Format([QTDate],"mmmm yyyy") AS MoName
FROM MainTBL
ORDER BY Month([QTDate]);

How to change this code to make it sort on Month and Year, not just month?

View Replies


ADVERTISEMENT

Queries :: Matching Dates By Month And Year

Aug 27, 2013

Looking to match to date fields within a query by using the month and year only, is it possible and how.

I'm using Access 2003

View 13 Replies View Related

Queries :: Eliminate Records With Dates In Same Month

Jun 17, 2015

I am trying to figure out a logical WHERE condition. I have a Query that gives me data,

Code:
Name | Start | End
--------+-----------------+-------------
Paul | 30-May-15 |
Eugin | 21-May-15 | 28-May-15
Francis | 04-Mar-15 | 08-May-15
Samuel | 10-May-15 | 13-May-15

I want to have only Paul and Francis. As Eugin start is 21-05-2015 and End is the same month, so is Samuel's. So I want to eliminate those two records.I have checked pbaldy's web of overlapping records. But unlike that, I need something customised.

Begins and ends before range - we don't want - Yes
Begins before, ends during - we want this one - Yes
Begins and ends during - we want this one too - NO
Begins during and ends after - we also want this one - Yes
Begins and ends after - we don't want this one - Yes
Begins before and ends after - we want this one -NO

View 5 Replies View Related

Queries :: Expression To Show Years And Month Difference Between 2 Dates?

May 6, 2014

I am wanting to get an expression that will return the difference in years and months between 2 dates. Specifically, I want to know peoples ages in years and months based on a person's D.O.B and todays date. I have managed to do it in years:

Expr1: DateDiff("yyyy",[TBL_EmployeeDetails]![D_O_B],Date())

and in months but I would like to know how to return the difference in years and months.

View 1 Replies View Related

Queries :: Dates In A Query - Show Orders By Month For Last 12 Months

Apr 22, 2013

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.

View 6 Replies View Related

Queries :: Rolling 12 Month Query - Keeping Track Of Orders Placed For Given Part Number By Month

May 5, 2014

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.

View 2 Replies View Related

Displaying 'deadline' Dates Depending On The Activity

Feb 1, 2008

Not really sure how to word this as I'm not sure if I even understand.
Basically I have been asked to set up a database logging distubances and need to display on the form 3 different dates (action by, monitoring period and date to close case) from the date the data is entered, depending on the disturbance chosen.

So if there was noise nuisance the action date would be 7 days, the monitoring period would be 14 days and the closing date would be 90 days. This would be different from, say dog fouling. When the user chooses the disturbance from the combo box I need the dates to reflect the deadlines for that disturbance.

I have entered the number of days to add onto the table containing the disturbances (ie 7, 14 etc) and know how to add these days onto the original date.

How do I make this happen depending on the disturbance selecting.:confused:

Hopefully someone can help!

View 4 Replies View Related

Please Help To Group Dates By Next Month

Aug 21, 2007

I have a table column with dates like

02/05/06
02/06/06
...........

I need to calculate the next date[Due Date] in 6 months, which is simple

[Patient's file].[Last Appointment Date]+180 as [Due Date]

and I have to group the Due Date by the next month. Lets say the due date is 08/25/07, so it has to be grouped as September group at the top or the list. It should be displayed as "September, 2007"

How should I assing let say 08/01/07 - 08/31/07 dates to September groups. I mean the statement should be universal for any day and any month of the year.

Thank you.

View 1 Replies View Related

Show All Dates In Any Given Month / Quarter

Aug 10, 2005

I need a query that lists each day of the month (or quarter) that is selected from a form. Meaning, if a user selects June 2005 on the form, the query will return to show every date from June 1, 2005 to June 30, 2005. Is this simple, tiny little thing possible?

The reason behind this is that on a report, I need to show data for every date. If there is not data entered for that date, it still needs to appear with the date listed, but with no entries represented.

Thanks!
Tess

View 3 Replies View Related

Return Dates Based On Day And Month Only

Jan 3, 2006

I would like a query to return dates based upon the input of just the day and month. At the moment I have a parameter query which asks for 'start date' and 'end date' and this works fine, but I want the query to return all the records for all the years in the database and not just the current one (date format is dd/mm/yy)

So if I type <start date> 01/01 and <end date> 02/01 the query will return:

01/01/04
01/01/05
01/01/06
02/01/04
02/01/05
02/01/06

Does anyone know a solution - I have been searching all afternoon!!??

View 1 Replies View Related

Filter All Dates Within Current Month

Mar 21, 2015

I am probably quite wrong but I am trying to apply a filter that returns all dates within the current month

The bulk of the filter is from Microsoft Access examples.

Private Sub MonthB_Click()
DoCmd.ApplyFilter , "DueDate Year([DueDate]) = Year(Now()) And Month([DueDate]) = Month(Now())"
End Sub

It is not working??

View 3 Replies View Related

How To Get Beginning And Ending Dates Of Current Month

Mar 14, 2005

I know i have read this before, and i have been searching for a hour now.

can someone tell me how set a variable = the beginning date ofthe month and another variable2 = the ending date of the month?

Thanks for your help!

View 1 Replies View Related

Modules & VBA :: Calculate Next Service Month Based On Dates

Jan 16, 2015

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

View 6 Replies View Related

Create Reports Showing All Start Dates By Month

Dec 8, 2014

I have a table that has the following:

ID
Program Year
Program
Start Date
Midpoint Date
Internship Date
End Date

I have successfully created queries to create reports showing all Start Dates by Month no matter what program and similar reports for all the other date queries. What I need it to do is list everything happening within a month and sort them by category. How do I do that? I've attached the database so you can see my queries as well as the main switchboard reports associated.

View 4 Replies View Related

Queries :: Calculate Expiry Dates Of Training Courses - Due Dates Not Shown

Aug 28, 2013

I have built a query to calculate the expiry dates of training courses but I am trying to input a criteria so that only dates within 90 days of todays date show. I am using Date()<90 but it doesn't return the correct information. What the criteria should be for this?

View 1 Replies View Related

Queries :: Access 2007 - Select All Dates Between Two Dates?

Apr 9, 2015

I have a table of records, which has within it two date fields (effectively, a 'start' and 'end' date for that particular record)

I now need to create a query to perform a calculation for each date between the 'start' date and the 'end' date

So the first step (as I see it anyway) is to try to create a query which will give me each date between the two reference dates, in the hope that I can then JOIN that onto another query to perform the necessary calculation for each of the returned dates.

Is there a way to do this?

So basically, if for a particular record, the 'start' date is 01-Apr-2015 and the 'end' date is 09-Apr-2015, can I produce a dataset of 9 records as follows :01-Apr-2015

02-Apr-2015
03-Apr-2015
04-Apr-2015
05-Apr-2015
06-Apr-2015
07-Apr-2015
08-Apr-2015
09-Apr-2015

(The *obvious* solution would be to create a separate table of dates, from which I could just SELECT DISTINCT <Date> Between #04/01/2015# And #04/09/2015# - but that seems like a dreadful waste of space, if that table is only required to generate the above? And it would have to cover all possible options; so it would either have to be massive, and contain every possible date - ever! - or maintained, adding new dates as necessary when they are required. Seems horribly inefficient!)

Is it possible to just select each date between the two reference dates? Or can you only query something which exists somewhere in a table?

View 4 Replies View Related

Queries :: Count Dates Between Dates In Two Tables

Jul 8, 2014

I have two tables with dates. Between (!) every two following dates in table1, I want to know the number of dates in table2. How do I write an SQL query for this? The tables I have are up to a few hundred records in table 1 and a few thousand records in table2. So to prevent that this takes hours I need a fast query.

To explain the query I need, for example:
table1
01/01/2014
15/01/2014
17/01/2014
30/01/2014

table2
01/01/2014
02/01/2014
05/01/2014
17/01/2014
18/01/2014
20/01/2014
21/01/2014
25/01/2014

So the answer of the query would be 2,0,4.

Explanation:
Between 01/01/2014 and 15/01/2014 in table 1 there are 2 dates in table2 (01/01/2014 is not included between the dates)
Between 15/01/2014 and 17/01/2014 in table 1 there are 0 dates in table 2
Between 17/01/2014 and 30/01/2014 in table 1 there are 4 dates in table 2

View 2 Replies View Related

Queries :: Joining 3 Queries And Displaying Results In Separate Columns

Jul 31, 2013

I have 3 queries named Mech Final Equipment 3 Mth, Mech Final Equipment 6 Mth, and Mech Historical Final Equipment.They all have two fields-Final equipment and Sum of Sum of Down (calculating the number of minutes each piece of equipment was down in the time period selected).

My ultimate goal is to join the three queries to display a pivot chart that uses the Final Equipment as the category field and 3 Mth, 6Mth, and Historical as seperate data fields.What I have is a join query (Which I have named Mech Final Equipment H63 Joined)

Using this SQL:

Code:

SELECT DISTINCTROW [Mech Final Equipment 3 Mth].[Final Equipment], Sum([Mech Final Equipment 3 Mth].[Sum Of Down]) AS Duration
FROM [Mech Final Equipment 3 Mth]
GROUP BY [Mech Final Equipment 3 Mth].[Final Equipment]
UNION

[code]...

Which returns a table that looks like this:

Final Equipment, Duration

Ancillary Equipment, 225
Ancillary Equipment, 401
Ancillary Equipment, 1787
Brush Unit , 1252
Brush Unit , 2519
Brush Unit , 8004

And so on.What I need the table to look like is this

Final Equipment, 3 Mth, 6 Mth, Historical

Ancillary Equipment, 225, 401, 1787
Brush Unit, 1252, 2519, 8004

And so on, like a cross tab.I tried to do a crosstab query but I don't have enough fields.

View 6 Replies View Related

Displaying Queries Thru MsgBox

Aug 14, 2007

Hi,

Need help on how to display queries by using MsgBox. Reason being is would like to view my selection criteria to check why is it not displaying records though they exist in table.

Many thanks.

View 3 Replies View Related

Queries :: SQL Code For Displaying Max Date

Apr 13, 2015

I need displaying the max date sql code below;

PHP Code:

SELECT TblDietPlan.DietPlanID, TblDietPlan.ClientID, TblDietPlan.MealDate, TblDietPlan.MorningSnack, 
TblDietPlan.AfternoonSnack, TblDietPlan.EveningSnack
FROM TblDietPlan
WHERE (((TblDietPlan.ClientID) Is Not Null) AND ((TblDietPlan.MealDate)=Max()))
ORDER BY TblDietPlan.MealDate DESC; 

View 4 Replies View Related

Queries :: Displaying Records Horizontally

Nov 29, 2013

If you have a one - many relationship between data, normally in the table it is captured, you would find multiple rows for every 'thing', each row detailing different 'functions' performed on it.

Is there a way that one can display these functions horizontally, instead of vertically, i.e, have one row per 'thing', instead of multiple rows.

View 3 Replies View Related

Queries :: Displaying Column 1 Instead Of 0 In Query

Nov 14, 2013

I have a combo box which queries a table and then stores said tables primary key field in a field for my main table. The table queried has two fields; one for the primary key and the other for the string, such as "chris".

My problem is when I run new query from the main table it shows the bound column, which is the primary key, instead of the string column which would display my name. I can't figure out if there is code that I should deposit in the criteria field that would tell the query to display the name field (ala "Chris") instead of the bound column field (ala primary key).

Do I need to add something to the criteria field or run an expression that says display column 1 instead of column 0 in your quey?

View 5 Replies View Related

Queries :: Only Displaying Unchecked Records?

Jan 17, 2015

I want to run a query to show all my outstanding orders between two dates. I've done all this correctly and it works fine. However I only want the query to show me the records where the checkbox on 'tblOrders' is unchecked. For obvious reasons, I don't need to see these records, just that records that have been checked, therefore are outstanding.

View 5 Replies View Related

Queries :: Last Row Only By Month

Apr 9, 2014

I have a table set up like:

CUSTOMER ID / CUSTOMER NAME / PAYMENT ID / PAYMENT DATE

Only want to show the last of each payment per month in form based on query.

So if they have a payment in April of $900 on 4/15 and then a payment in May 5/2 $500 and May 15 $1000

It will show two rows...one for April $900 payment and one for May $1000 payment.

I know the logic is something like

If more than one payment row for month, show last, otherwise only one payment for that month show the one payment.

I tired just setting hte "last" paramater but it only shows the very last payment, not taking month into account. So it only shows the $1000 may payment. thx

View 3 Replies View Related

Queries :: Displaying All Records But Filtering Certain Fields

Nov 21, 2013

I have a query that carries all the properties in our database, and data for when our company 'worked on' properties. Each property falls within a certain province and municipality (this is slightly irrelevant info) , we worked on properties in a period from 2009 - 2013/06/30 this period is called '2009', and we have again worked on properties during a period 2013/07/01 onward - this period is called '2013'.

Now I require this query to display all the properties, but only the entries in certain fields, that relate to '2013'.

I have about 7 fields where this date (either 2009 or 2013) can be displayed, I tried to filter them all simultaneously by using the criteria: Is Null Or "2013", in every one of these fields, but this criteria results in me losing entire records that contained 2009 data, instead of the data simply not being displayed. Even in cases where some of the 'date' fields contained 2013.

How I can keep all records but simply display info relating to work we did in the 2013 period?

View 8 Replies View Related

Queries :: Displaying Only 1 Result In A Query Column?

Jun 2, 2013

1 I have a delivery method column and I want to only show 1 type for each method. How would I do that? Is it in expression builder?

View 1 Replies View Related







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