Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Login to participate.
Need help with MS Access
|
|||||||
![]() |
| Thread Tools |
|
#1
|
|||
|
|||
|
Need help with MS Access
I have a table of daily sales revenue for the past 3 years. I need to do a query that will calculate weekly sales revenue for each year and compare it to the same week in the prior years. Anyone have any ideas on this?
Thanks, Brian |
|
#2
|
|||
|
|||
|
I would suggest breaking the table into three tables- one for each year.
Then run a query to sum a range between 1/1 and 1/7. Then 1/1+7, 1/7+7.. Probably do this with vba. Take those results, put them in a table or array, and do the same for each year. Compare results with vba as the final part of a query form. Just my two cents- lots of nice in theory things here, but depending on your usage you'll probably be banging your head to do that. Keeping in mind that there are 52 weeks per year, just do sums for each 7 day period, give it a week number. Then compare against week X, week x+52, week x+2*52, etc.. That would work in a single table, but you still gotta store results for a bit. BTW- Welcome to techspot! |
|
|
|
#3
|
||||
|
||||
|
Select the sales figure for the year and subtract the previous year's figure using a subselect where year = year - 1. Group by week. Something like that. Be more specific and post the table/column names if you want more useful help.
|
|
#4
|
||||
|
||||
|
I too was thinking along similar lines of Goalie, but I'd just skip the last table, and do the math in the query.
Takes up a bit less space that way ![]() Dunno why you'd need VBA though. I'd think that'd just make it harder, as all you've got to do with the regular commands is to mulitply the rows (or columns) with 7.. Here's a little Excel style sample (dunno if it's the same in Access, as it's over 4 years since I used it last. And it's only 3 since I used excel). (you'll either need to get at the index number, or have a column for week/index which can be accessed) Code:
=((B$(A$1*7))+(B$((A$1*7)+1))+(B$((A$1*7)+2))+(B$((A$1*7)+3))+(B$((A$1*7)+4))+(B$((A$1*7)+5))+(B$((A$1*7)+6))) BTW: Sorry if the example is wrong, but I'm tired, had a bit to drink and haven't used excel nor access in several years. But the logic behind it should still be applicable. |
![]() |
| Thread Tools | |
|
| Similar Topics | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drive image access denied? | Rick | Storage & Networking | 8 | 06-19-2007 06:03 PM |
| The art of gaining local access | Phantasm66 | Misc. Software & Utilities | 9 | 01-18-2006 01:40 PM |
| backdoor virus, access denied windows xp..Help | darjud | Security and the Web | 18 | 03-09-2005 08:45 AM |
| Help - can't access XpPro PC over network | technoheckno | Storage & Networking | 24 | 11-24-2004 06:28 PM |
| How can I gain administrator access? | ranger0001 | Windows OS | 4 | 08-28-2003 04:12 PM |
All times are GMT -4. The time now is 06:10 AM.




