Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Sign up or Login to participate.
Collaborate in the cloud with Office, Exchange, SharePoint, and Lync
|
|||||||
Collaborate in the cloud with Office, Exchange, SharePoint, and Lync
Need help with MS Access
|
|
Thread Tools | Search this Thread |
|
#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. |
![]() |
| Similar Topics | ||||
| Topic | Replies | Forum | ||
I have internet access, but no browser or pop mail access
|
5 | Windows OS | ||
Can't open Access control editor. Access is denied.
|
3 | Windows OS | ||
Lost access to data on hard drive in Windows - how to get access back?
|
2 | Storage and Networking | ||
Access Denied, when i access the my computer icon and its properties
|
2 | Windows OS | ||
Messed up computer and cannot access internet, page says cache access denied
|
1 | Windows OS | ||
| Thread Tools | Search this Thread |
|
|
All times are GMT -4. The time now is 12:45 AM.




I have internet access, but no browser or pop mail access