473,656 Members | 2,997 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 1014
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
6703
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 running OK for years in Access 2003; it adds an item selected from an inventory listing to either an existing Sales Order or Purchase Order. For historic reasons Purchase orders are alphanumeric and Sales orders are numeric (long integer). The RowSource...
4
31377
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 "View" part of the "Home" tab because users like being able to flip between Form View and Datasheet View in the forms. It turns out that on our network, if a user inadvertantly clicks Design View, then the database becomes locked to new users until...
3
6062
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 password. i also have a table containing all usernames and passwords. i also have a query that references the table with criteria set to match the form text box data with the table data. this "verification" occurs on click on a button on the fowm....
4
10512
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 intend on keeping the .mdb format for the time being, so I'm not performing a true conversion...just trying to get it to work in the new version. I'm familiar with a number of areas in 2003 that have to be modified to work in 2010, but my issue today...
17
12389
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 have a bunch of machines running on the same front end, and the machine with MS Access 2010 generates an error that the function cannot be found in the line of code that uses that function. Any ideas? This is the line of the query that generates...
7
7966
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 to keep track of the maintenance on our vehicles. To do this I created a pretty simple Access 2010 database. Everything was going pretty well until I realized that I couldn't go any further without some help... so here I am! In an effort to...
11
2697
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 have a rudimentary understanding of it. This code was not written by me and I am still trying to understand why it doesn’t work? I have posted the code below; this is what it is supposed to do: I have a main form that displays each record. The form...
3
2172
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 be 1, Subproject 1 12/2011 would be 2, and Subproject2 3/2009 would be 1. So, I am trying to use a DCount in an Access 2010 query. This is my SQL: SELECT qLbrEstModelBaseHours.SUBPROJECTID, qLbrEstModelBaseHours.FISCALYEAR,...
2
1316
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
1136
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 delivers support for frail aged clients daily based on their individual requirements. For any particular client we need to know whether they require a service call today or any selected day, based on the following conditions: Certain days the...
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1928
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.