473,443 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Recategorise Date Results

Hi.

I'm trying to sort an existing categorising query to categorise by financial years. I've managed that, but it won't re-categorise once the extra calculation fields are added. Any ideas?
Expand|Select|Wrap|Line Numbers
  1. SELECT   [CM Database].[Age Range],
  2.          Count([CM Database].[Age Range]) AS [Count],
  3.          Year([Date Contacted])-IIf([Date Contacted]<DateSerial(Year([Date Contacted]),4,1),1,0) AS FinYr,
  4.          [FinYr] & "/" & Right(([FinYr]+1),2) AS [Financial Year]
  5. FROM     [CM Database]
  6. GROUP BY [CM Database].[Age Range],
  7.          Year([Date Contacted])-IIf([Date Contacted]<DateSerial(Year([Date Contacted]),4,1),1,0),
  8.          [FinYr] & "/" & Right(([FinYr]+1),2)
  9. HAVING   ((([CM Database].[Age Range]) Is Not Null)
  10.    AND    ((Year([Date Contacted])-IIf([Date Contacted]<DateSerial(Year([Date Contacted]),4,1),1,0))=[Year]))
  11. ORDER BY [CM Database].[Age Range];
Feb 19 '10 #1
1 1217
NeoPa
32,556 Expert Mod 16PB
This post has been split from another thread. I couldn't see any relevance to that thread but it is at Connection ACCESS 2007 with SQL Performance in case that's important. I expect, as a new poster, you're simply unaware of some of the dos & don'ts related to posting on our forums. A quick browse through the Help link at the top of each page will help you there I'm sure.

Firstly, I have tidied up your post somewhat to make it easier to read, with code tags etc. Please note and follow suit in future.

The question probably made sense to you when you wrote it down, but from the perspective of someone who doesn't already know what you're thinking, it's a bit confusing. I'll hazard a guess and you can explain further if I'm wide of the mark. Please remember in future that, for much better results, it does help to read your post back after posting to make sure it conveys what you intend.

In this case, I think you're (probably) falling over conversion issues. Where you are dealing with dates or numbers, it is better to leave the data as dates or numbers until all processing has been finished (IE. Don't convert then try to use the converted results for any further categorisations). Converting numbers to formatted strings, or dates to either numbers or formatted strings, inhibits the ability further down the line of processing the items in their native form. You are reduced to treating them in their new form(s) which can be restricting.

I hope this resolves your issue and Welcome to Bytes.
Feb 21 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: paulus4605 | last post by:
Dears I have the following problem I’m using a query to get all the data from my database from the past year the second query is displaying the results by month. How can I match the second...
6
by: Thomas Scheiderich | last post by:
I have the following page as test.aspx: *************************************************** <html> <head> <title>Hello and Welcome Page</title> </head> <body> <center> <% Dim CurrentDate As...
1
by: Neo Geshel | last post by:
I am having conflicting results with two pieces of identical code. One is an insert, the other is an update to a db. The first code, which works, is this: Sub Add3_Click(sender As Object, e As...
6
by: supasnail | last post by:
I've been going round in circles here trying to get this to work and my ignorance of ASP is now showing me up. I want to construct a query string to allow me to filter entries to be displayed on...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
2
by: milo1955 | last post by:
I have a form that passes a single variable via the GET function to a mysql databse query with the results paginated. The first page of the results work fine, but the link to the second page yields...
3
by: Jensen.Katie | last post by:
I have a SQL Server 2005 DB that I set up an ODBC connection to so that people can access the data through MS Access. There are 3 tables, each of which have a date column that is a varchar (20)...
2
hodgeman
by: hodgeman | last post by:
My second thread on thescripts, so hoping to get the same feedback and help as last time... I've developed an online invoicing and payment system for all my accounts for my web design company....
1
by: Arli | last post by:
I have the following linked tables: tblMainPL is my main table that I need to pull the information in from. It has the following fields: Autonumber1 -PK set as autonumber Date - short date...
1
by: blondieUA | last post by:
Hello guys! I have some problem with creating the result page :( I need to create a web-page for my college course in Computer Science. I decided to create a site about Horoscopes. So if a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.