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

Query Problem

Hello All,

I have just got thrown something at me for this Monster i have created :D. Well I am not exactly sure how to go about getting what I need in the report, but I know I have to do something with the query. What I have going is a full report of all jobs in my work place, in the report it shows Total workers per job, workers on vacation, works that have Permanent ID cards and workers that have temporary ID cards. What i want to do is subtract the records that have the on vacation fields checked, this way the numbers are more accurate, but at the same time keep the count of on vacation.
Jul 7 '07 #1
10 1223
Bump,Bump,Bump,Bump,Bump,Bump,Bump,Bump,Bump,Bump, Bump,Bump,
Jul 9 '07 #2
puppydogbuddy
1,923 Expert 1GB
Hello All,

I have just got thrown something at me for this Monster i have created :D. Well I am not exactly sure how to go about getting what I need in the report, but I know I have to do something with the query. What I have going is a full report of all jobs in my work place, in the report it shows Total workers per job, workers on vacation, works that have Permanent ID cards and workers that have temporary ID cards. What i want to do is subtract the records that have the on vacation fields checked, this way the numbers are more accurate, but at the same time keep the count of on vacation.
I am not sure of what you want, but here is my suggestion based on the above description.

Your totals that you have now are probably in the Report Footer. I suggest that you add a Vacation Row to the report footer, and also, an Adjusted total row as illustrated below:

..............................Total Workers...........Permanent...........Temporary... .
................................All Jobs....................ID Cards..............ID Cards.....
Unadjusted Totals...........500..........................430. .......................70
..Vacation Adj..................( 14).......................( 14)........................(0)
Adjusted Total................486.......................... 416........................70 .......


From your description, you already have the unadjusted totals above from the textboxes in the report footer. For the vacation adjustment row, you can put an expression similar to the following in the textboxes as shown.:
=Sum(IIf([VacCkbox] = True,Count([VacCkBox]),0))

And an expression similar to the folowing for the adjusted total:
= [NameofYourAdjTotalTxtbox]- [NameofYourVacAdjTxtbox]
Jul 9 '07 #3
Thank you for your reply and sorry about not explaining it well. Truthfully I don't really know how to explain it to well. I do need the totals to be deducted as well, but my main purpose is the actual data in the detail section. I tried to put the code that you gave me in the detail section and take the same steps as in the footer, but i couldn't get it to work, kept giving me an error saying the code was wrong. I think the problem is that it couldn't find the field Vacation, because in the query i am basing this off of, is an expression counting all of the true boxes. I tried to add just the Vacation field to the end of the query and just do a group by, this way I could use it in the code, but every time it would mess up my numbers.
Jul 9 '07 #4
puppydogbuddy
1,923 Expert 1GB
Thank you for your reply and sorry about not explaining it well. Truthfully I don't really know how to explain it to well. I do need the totals to be deducted as well, but my main purpose is the actual data in the detail section. I tried to put the code that you gave me in the detail section and take the same steps as in the footer, but i couldn't get it to work, kept giving me an error saying the code was wrong. I think the problem is that it couldn't find the field Vacation, because in the query i am basing this off of, is an expression counting all of the true boxes. I tried to add just the Vacation field to the end of the query and just do a group by, this way I could use it in the code, but every time it would mess up my numbers.
You can only have detail amounts, not summations in the detail section. What you can do is eliminate the detail by erasing the textboxes or making the entire detail section not visible, and just show totals for each group in the group footer. For example, if you wanted to see a total for each employee, but not the detail of each paycheck......you would show no details, and group by employee with the totals in the employee group footer.
Jul 9 '07 #5
You can only have detail amounts, not summations in the detail section. What you can do is eliminate the detail by erasing the textboxes or making the entire detail section not visible, and just show totals for each group in the group footer. For example, if you wanted to see a total for each employee, but not the detail of each paycheck......you would show no details, and group by employee with the totals in the employee group footer.
I need the detail amount, that is my main focus
Jul 9 '07 #6
puppydogbuddy
1,923 Expert 1GB
I need the detail amount, that is my main focus
Ok, then post the SQL for the query you are currently using as the source for your report.
Jul 9 '07 #7
SELECT tblAll.Jobs, Count(tblAll.Name) AS CountOfName, Sum(tblAll.[Vacation])*-1 AS [SumOfOff Base], Sum(tblAll.IDCard)*-1 AS SumOfMNFIBadge, Count(tblAll.IDCard)+Sum(MNFIBadge) AS CountOfIDCard, Sum(tblAll.[Interview Complete])*-1 AS [Interview Complete], Count(tblAll.[Interview])+Sum([Interview]) AS [CountOfInterview Complete], Sum(tblAll.Temporary)*-1 AS SumOfTemporary, Count(IIf([tblAll.IDCard]=14,[tblall.IDCard])) AS CountOfIDCard
FROM tblAll
GROUP BY tblAll.Jobs;
Jul 13 '07 #8
puppydogbuddy
1,923 Expert 1GB
SELECT tblAll.Jobs, Count(tblAll.Name) AS CountOfName, Sum(tblAll.[Vacation])*-1 AS [SumOfOff Base], Sum(tblAll.IDCard)*-1 AS SumOfMNFIBadge, Count(tblAll.IDCard)+Sum(MNFIBadge) AS CountOfIDCard, Sum(tblAll.[Interview Complete])*-1 AS [Interview Complete], Count(tblAll.[Interview])+Sum([Interview]) AS [CountOfInterview Complete], Sum(tblAll.Temporary)*-1 AS SumOfTemporary, Count(IIf([tblAll.IDCard]=14,[tblall.IDCard])) AS CountOfIDCard
FROM tblAll
GROUP BY tblAll.Jobs;
The above query is a summation (totals) query with no detail info. If you want detail and summation info in this query, undo the summation (click the summation key on the toolbar), use groupby's to group details and use Dcount and DSum for your aggegated totals....or leave your query at the detail level and do the summation through the report.
Jul 13 '07 #9
It already works with the detail section, it gives me the totals for every job that is what i am looking to do, But, not having the off base records count. yet at the same time show the total of the off base records still be there, and not 0
Jul 13 '07 #10
puppydogbuddy
1,923 Expert 1GB
It already works with the detail section, it gives me the totals for every job that is what i am looking to do, But, not having the off base records count. yet at the same time show the total of the off base records still be there, and not 0
Try using the domain aggregate functions like DCount or DSum for those totals ....
Jul 13 '07 #11

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

Similar topics

13
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP (running off Apache 1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using...
3
by: Brian Oster | last post by:
After applying security patch MS03-031 (Sql server ver 8.00.818) a query that used to execute in under 2 seconds, now takes over 8 Minutes to complete. Any ideas on what the heck might be going...
1
by: Jeff Blee | last post by:
I hope someone can help me get this graph outputing in proper order. After help from Tom, I got a graph to display output from the previous 12 months and include the average of that output all in...
8
by: Adam Louis | last post by:
I would like help resolving this problem. I'm a novice who's been hired to query a hospital database and extract useful information, available to me only in a dynamically generated, downloadable...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
11
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive...
4
by: Konrad Hammerer | last post by:
Hi! I have the following problem: I have a query (a) using another query (b) to get the amount of records of this other query (b), means: select count(MNR) as Number from...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
2
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...
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.