473,395 Members | 1,516 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,395 software developers and data experts.

Combining information form two queries into one report.

Altius
2
Access Version: 2003
OS: XP Pro
Sorry if this is a bit long winded. First a little info about the database. This database is used to keep track of checkout information from our production department. It has three main tables that store information, the first one, that I have named "Checkout", stores the information I am querying for the two reports. It has six different fields - OrderNumber, Date, CheckedBy, BuiltBy, SerialNumber, and ComputerType. Using the following query, I pull information for a certain person and date range then group based on the date and computer type, count up the number of that computer type for that date and calculate the hours of work that translates to.

(Query 1)
Expand|Select|Wrap|Line Numbers
  1. SELECT Checkout.Date, Checkout.BuiltBy, Checkout.ComputerType,
  2. Count(Checkout.ComputerType) AS CountOfComputerType,
  3. IIf([ComputerType]="Desktop",[CountOfComputerType]*1,
  4. IIf([ComputerType]="Laptop",[CountOfComputerType]*0.5,
  5. IIf([ComputerType]="Server",[CountOfComputerType]*2,
  6. IIf([ComputerType]="MB Kit",[CountOfComputerType]/12)))) AS Hours
  7. FROM Checkout
  8. GROUP BY Checkout.Date, Checkout.BuiltBy, Checkout.ComputerType
  9. HAVING (((Checkout.Date) Between [Forms]![Production Report]![From Date] And [Forms]![Production Report]![To Date]) 
  10. AND ((Checkout.BuiltBy)=[Forms]![Production Report]![TechName]));
  11.  
In the second query, which follows, I select the number of machines they have checked out by using the same date range from above and searching for their initials in the "CheckedBy" field, then count the number of occurrences and calculate the hours of work that translates to.

(Query 2)
Expand|Select|Wrap|Line Numbers
  1. SELECT Checkout.Date, Checkout.CheckedBy, Count(Checkout.CheckedBy) AS CountOfCheckedBy, [CountOfCheckedBy]/3 AS Hours
  2. FROM Checkout
  3. GROUP BY Checkout.Date, Checkout.CheckedBy
  4. HAVING (((Checkout.Date) Between [Forms]![Production Report]![From Date] And [Forms]![Production Report]![To Date]) 
  5. AND ((Checkout.CheckedBy)=[Forms]![Production Report]![TechName]));
The problem is that I am not sure how to combine the information from these two queries in one report that will list the total number of calculated hours by day and then put an average for the these days at the bottom of the report.

Anybody have any thought?
Apr 3 '07 #1
1 2266
Altius
2
It took me two day but I came up with a solution. I had to create four different queries, one main report, and four different subreports.
Apr 4 '07 #2

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

Similar topics

7
by: frizzle | last post by:
Hi, I know this might sound strange but i think(/hope) it's quite simple: I'm running 2 queries in a mysql DB, first one returns 20 results. Now how can i echo results from the second query...
1
by: Anne | last post by:
I have a report containing multiple subreports (approximately 37 subreports) that are based on individual queries. The query calls to only display the subreport if there is valid data in the table...
2
by: Simon Pleasants | last post by:
Am something of a newbie at this, so please bear with any stupid questions. I have created a database to track shipments that we import. The information is stored in a table and I have created...
2
by: Sherman H. | last post by:
I have a few questions for crosstab and popup form questions: 1. I created a crosstab as follows: IT Financial Operation John 21 22 ...
4
by: justin tyme | last post by:
Hello Experts! I would like to combine (which may not be the correct technical term) two text fields from the same table in a query. Specifically, text field A and text field B are both lists of...
2
by: afr0ninja | last post by:
Hello! I'm fairly new to access, but I'm starting to get the hang of it. This will be a bit lengthy but hopefully it'll have enough information for some kind soul to help me out. I'm currently...
7
by: tcveltma | last post by:
Hi again, Ok, so I have about 15 crosstab queries. Each crosstab query is an employee's name. Within the query are the weeks as the column heading, the work order numbers as the row heading, and...
19
by: Gilberto | last post by:
Hello I have created TWO different queries (for products belonging to FRONT and REAR) which use product information to filter the total (sum all belonging to the same category) of all the FRONT...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
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: 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: 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
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
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
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
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...

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.