473,503 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculate OTD query in Access 2010

1 New Member
I would like to calculate OTD for each month of the current year seperately. I would like to group for each month the ship to location with a subtotal of OTD for each location. I would also like to subgroup the different jobs/parts for each location with an OTD percentage for those as well if possible. I have fields: Date (date of shipper), Quantity, Ship to, and job number. This would require using the fields: early, on time, and late but would not require these fields to be visible on the query. The calculation needs to be based on the quantities of each part of each shipment NOT based on how many shippers are marked on time, early or late.

Stumped
Access 2010
Nov 23 '15 #1
3 1010
zmbd
5,501 Recognized Expert Moderator Expert
Hello Stumped2015,
Sounds like you are looking at a crosstab query (CTQ); however, a bit more complex than usual.

I would suggest that you start with Allen Browne's article on CTQs >> Crosstab query techniques .

Once you have the basic concept we can start to help you tweak your initial SQL structures. Unfortunately we do need you start the basic SQL as we do not have your database to work with :)

You will also find several threads covering various aspects of CTQ implementations and pitfalls:
https://bytes.com/searchresults.php?...ery&gsc.page=1
Nov 23 '15 #2
hvsummer
215 New Member
@zmbd: I don't think CTQ can handle his request.
He will need pivottable to have subtotal.

@Stumped2015: 1 best solution for you are to prepair data in Access then pivot it in excel, you can subtotal/analysis everything better in excel.

or you can create subtotal with group by query.

1 idea have been pop up in my mind, wait a minute.

hahahah, okok, I finnally found the way to show up Subtotal in groupby query, thank Stumped2015 for asking, you help me too much :3

Expand|Select|Wrap|Line Numbers
  1. SELECT Group, SubGroup, Sum(Qty) as MTD
  2. FROM Table1
  3. GROUP BY Group, SubGroup
  4. ORDER BY Group, SubGroup
  5. UNION ALL
  6. SELECT Group, "Total "&Group as SubGroup, Sum(Qty) as MTD
  7. FROM Table1
  8. GROUP BY Group
  9. ORDER BY Group, SubGroup;
  10.  
yeah, that SQL will give you subtotal in Total/GroupBy Query.
Nov 23 '15 #3
zmbd
5,501 Recognized Expert Moderator Expert
Stumped2015,
It would be helpful to see how you want your data to be presented. To do this, Click on the [CODE/] button in the post toolbar. Then between the [code][/code] tags insert your table/report using spaces not tabs to setup your columns.

From what I am reading this is what you are after:
(of course, the suffix "N" is any arbitrary number :) )
Expand|Select|Wrap|Line Numbers
  1. [         ][January][February][March]...[December]
  2. [Location1][OverT  ][OverT   ][OverT]...[OverT   ][subtotal]
  3.    [Part1 ][%OverT ]...
  4.    [Part2 ][%OverT ]...
  5.    [Part3 ][%OverT ]...
  6.    [PartN ][%OverT ]...
  7. [Location2][OverT  ][OverT   ][OverT]...[OverT   ][subtotal]
  8.    [PartN ][%OverT ]...
  9.    [PartN ][%OverT ]...
  10.    [PartN ][%OverT ]...
  11. [Location3][OverT  ][OverT   ][OverT]...[OverT   ][subtotal]
  12.    [PartN ][%OverT ]...
  13.    [PartN ][%OverT ]...
  14.    [PartN ][%OverT ]...
  15. [Location4][OverT  ][OverT   ][OverT]...[OverT   ][subtotal]
  16. ...
  17. [LocationN][OverT  ][OverT   ][OverT]...[OverT   ][subtotal]
  18.    [PartN ][%OverT ]...
  19.    [PartN ][%OverT ]...
  20.    [PartN ][%OverT ]...
This might be better handled in a report; however, I think we need a clearer picture of the desired results.
Nov 24 '15 #4

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

Similar topics

2
6691
by: sierra7 | last post by:
It seems Access 2010 is associating an 'input mask' or field type with a combo box when a form is opened, even though there is no Format setting on the control. I have a form which has been...
4
31360
by: jbrumbau | last post by:
Hello, In Access 2010/2007, how do you prevent users from flipping into design view from the ribbon? I do not want to hide the entire ribbon (DoCmd.ShowToolbar "Ribbon", acToolbarNo) or even the...
3
6044
by: john latona | last post by:
hi! i realize that access 2010 does not have the username and password function built into it, so i am trying to build it into my db. i have a "login form" with text fields titled username and...
4
10486
beacon
by: beacon | last post by:
Hi everybody, My title may not exactly describe my issue, so please forgive my lack of creativity today. I've got a database that was created in Access 2003 that I've opened in Access 2010. I...
17
12372
twinnyfo
by: twinnyfo | last post by:
Hey coders, Has anyone heard anything about the Date() function no longer working (or working differently in MS Access 2010? I have an MS Access 2007 DB that has worked perfectly, however, we...
7
7949
dgaletar
by: dgaletar | last post by:
To start off, I am a serious "newbe" to Access, and have probably made countless mistakes thus far in the design of this database. I work as a fleet mechanic for a University in DC, and am trying...
11
2686
by: Redbeard | last post by:
I have just upgraded to Access 2010 (64 bit) from Access 2007. There were a few minor issues in the database which I have resolved but this one piece of code just won’t work. I do not write VBA but...
3
2163
by: time2hike | last post by:
Hi, I have a query that pulls in hours for multiple Subprojects by Month and Year. To be able to compare data I need to Count the Month & Year for each subproject. Example Subproject1 11/2011 would...
2
1306
by: CLSkcab | last post by:
Background: Front End: MS Access 2010/VBA, Back End: MS SQL Server 2008 Can an Access 2010 program start another Access 2010 program and pass data to the one it starts? Thanks in advance.
5
1126
by: stevekos07 | last post by:
I hope this isn't too confusing for you to be able to assist me. I have a requirement to produce a yes/no result in a form field based on a range of conditions in a query. We are a service which...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
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
7273
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
7322
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
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5000
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
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.