473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

column for month todate, year todate and comparative number from last year

I am trying to write a query to extract product sales data. Columns are product code, qty, current month sales, ytd sales for current year and comparative number for last year. How do I write the query to pull data for current year and comparative period for last year. I will have a pararameter for user to enter the month end date e.g Mar 31, 2012 as 03/31/2012.
Also, anyone can show me what criteria should be for Month to date and year to date for current year and last year. I am new to ACCESS and know basic query.

Thanks

Edward
Mar 11 '12 #1
5 2218
Mihail
759 512MB
Is not clear for me why you store the sales month while you can store the sales date ?
If you use date then you can show everything you wish:
- Sales before a certain date;
- Sales between certain dates;
- Sales in a certain year, month, day or, if you store dates including the time, even sales in a certain hour, minute, second;

and so on.

Take a look here before go forward with your database:
http://bytes.com/topic/access/insigh...ble-structures
Mar 11 '12 #2
Thanks for your reply. The scenario I described is the report column. The Table do have field for Invoice date, invoice no., unit price etc and linked to other related tables. I want to make a report to show sales by product showing month sales, YTD sales for current year and comparative period for last year. I would like to know how to write the query to feed data for the report.

Thanks
Mar 12 '12 #3
Mihail
759 512MB
I make this new post because no one else answer you.

I think I can see a solution for your problem but is based a lot on VBA and only a little bit on SQL (queries). Maybe because I have good skills in VBA but almost zero in SQL.

But first of all I need to know exactly what you have or what you can do (the questions are not about your skills; there are about your database).

1) Can you define a query ? (let's name it qProducts) with this fields: Product_ID , Product_Name
2) Can you define a query ? (let's name it qSales) with this fields: Product_ID , DateOfSale , Quantity

If you are able to do that inform me and we'll try together to develop a strategy.
Mar 12 '12 #4
@Mihail
Thanks for your response and patience. Yes I know how to define basic query. For 1) I will write the query as:
select PRODUCT_ID, PRODUCT_NAME FROM DATABASE_NAME WHERE PRODUCT_ID ="EXAMPLE"

2. SELECT PRODUCT_ID, DATEOFSALE, QUANTITY FROM DATABASE WHERE PRODUCT_ID ="SAMPLE"

In fact I have substantial experience in using crystal report using parameter,defining formulaes, use subreports etc. but rarely do reports in ACCESS. My experience with ACCESS mainly creation of database, define query for exporting data to excel for further analysis, I always want to advance my skill in ACCESS but mostly end up in writing crystal report as a result.
Mar 13 '12 #5
Mihail
759 512MB
I must repeat:
It is not about your skills. Is about how your database has been designed.
And from what I see in your last post you have a big problem here.
Take a very closer look to this: http://bytes.com/topic/access/insigh...ble-structures in order to understand why.

The IDs usually are long integers not texts.
Also they are the primary keys for tables.

So, the Product_ID can not be "EXAMPLE" or "SAMPLE" or, if is, you are in big trouble.

Can you post the database ?
See here http://bytes.com/forums/feedback/915...ase-other-work how to.
Mar 13 '12 #6

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

Similar topics

2
by: John | last post by:
If anyone can help me out with a good way to do this in javascript I would greatly appreciate it. I need to compute three dates in javascript - all of which relate to a given date, say todays...
1
by: Dan Leeder | last post by:
stroccur = DCount("", "empnotes", " = " & Chr(34) & Me.Rpt_Card_Type & Chr(34) & " And = " & Me.SSN & " And #" & & "# > " & DateSerial(Year(Me.datetime) - 1, Month(Me.datetime),...
1
by: Martin Emanuelsson | last post by:
Hello, Knowing year and weeknumber of this year, I'm looking for some way to get the date of the first and last day of that particular week. Does anyone have an idea about how to do this? ...
1
by: Frank Bishop | last post by:
I have been spoiled by some report writing tools that have intrinsic functions like Last Year Month-to-date. I'm looking for a way to emulate this in SQL Server now with my fields that are...
5
by: rjfjohnson | last post by:
Hey, Today is Thursday 16-Feb-06. The same thursday last year is 17-Feb-05. Because I am comparing daily sales between years, I need to know the date of the same weekdayname as last year, so...
6
by: phforum | last post by:
If user input the date is 2006-07-01. How to convert it to last year 2005-07-01? Thanks
3
by: cassey14 | last post by:
Hi Guys... Im doing a system and it really make my head ache..i hope somebody help me.. I need to have an id like this "ABCD-07-000001"... I dont know how will I work on that thing.. ABCD...
8
by: sanika1507 | last post by:
Hi all how to write this 01/01/ and whatever year is coming as current year -1....in an SQL query .i want it to write it in a stored proc... using SQL server 2000. Thanks in advance . .
0
by: pratapmysql | last post by:
Hello All, I am trying to get same day (name) of week of last year in this case date of day is not constraint eg. if december 2007-12-19 day is wednesday ,then last year 2006 wednesday for same is...
1
by: appu29 | last post by:
In my webpage, when i click "Past or Future" button to display "previous year leave summary or future year leave summary" respectively. It gives the error "Can't use an undefined value as a HASH...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.