473,396 Members | 1,853 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.

Totals in a query help please

14
Help please. Apologies but I am poor in access and programming :o) and am having trouble getting my head around this one!!...again!!!

I need to have a query or report to flag up someone who has been absent for over 8 days + in a 12 month period.

the relationship between tables is staffID. My sub table stores the absent occurences against my main Staff Names table. Obviously staff can have one or more occurences of being absent.

In my query I have a "dateStart" field which I have an expression which says > date -365 which filters my query to pull records within the last 12 months, so that's fine. I also have an expression field which tells me the number of days they've been absent =[enddate]-[startdate], so that's fine.

How on earth do I get to filter the query to show >8 days within last 12 months for one or more members of staff? If I do an expression of >8 it will ignore anyhting under 8 days although a staff member may have several occurences totalling 8 days...which is what I need to calculate and query.

I don't care how it's done, i just need help before i go maaaaaaaad!

Does this make sense? I would be extremely grateful of any comments on this (polite ones of course :o)

Regards, Graeme
Mar 13 '07 #1
6 1745
Rabbit
12,516 Expert Mod 8TB
Add a Count to your query grouping by Staff.
Mar 13 '07 #2
leeg
14
Thanks, but can you elaborate a bit more? I have looked at all those options but count seems to add a 1 to everything?

REgards

Graeme
Mar 13 '07 #3
Rabbit
12,516 Expert Mod 8TB
Sorry, forgot each occurence can be more than 1 day of absense, you'll want to sum the amount of days absent and group by their name.
Mar 13 '07 #4
leeg
14
THanks a lot. I said I was thick...

Do this in a report or query?

If it's in a report, how do I create a filter to filter data for over 8 days only for all staff?

MAny thanks in advance

Graeme
Mar 14 '07 #5
Rabbit
12,516 Expert Mod 8TB
You do it in a query, the same query that your report is based on. Click on View > Totals and it'll bring up the new options you need.
Mar 14 '07 #6
NeoPa
32,556 Expert Mod 16PB
THanks a lot. I said I was thick...

Do this in a report or query?

If it's in a report, how do I create a filter to filter data for over 8 days only for all staff?

MAny thanks in advance

Graeme
You can do this in one of three ways :
  1. Pass a WhereCondition parameter to the report on open when using DoCmd.OpenReport().
  2. Change the WHERE clause in your query.
  3. Edit the report itself to add a Filter condition (Property of the report object).
Mar 15 '07 #7

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

Similar topics

2
by: deko | last post by:
I have a number of queries that pull totals from different tables. How do I sum the different total values from each query to get a grand total? I tried using a Union query like this: SELECT...
4
by: New Guy | last post by:
I'm trying to work with a system that somebody else built and I am confounded by the following problem: There is a table of payments and a table of charges. Each client has charges and payments...
3
by: Joost | last post by:
I have a form based on a totals query, with one of the fields as the sum of the quantity of an article of the grouped records. I get an #error# in a control on the form where I want to display the...
2
by: BerkshireGuy | last post by:
I have the following code: Dim strSQL As String Dim DB As DAO.Database Dim RS As DAO.Recordset Dim intNumOfPaid, intNumOfHypoed, intNumOfNotTaken, intNumOfDeclined, intNumOfWasted,...
3
by: brm6546545 | last post by:
I have a tblTax. It has fields InvoiceNum, TaxAuthority, TaxableTotal, NonTaxableTotal, TaxCollected. Sample data 1,county,10.00,0.00,0.40 1,city,10.00,0.00,0.10 2,state,0.00,15.00,0.15 ...
9
by: MikeSA | last post by:
Hi I a trying to create a chart that reflects monthly cumulative totals from a query. The query fields show sales opportunities forecasted invoice date (OppForInvDate), Opportunity Description and...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
4
by: Micheal | last post by:
Greetings Access Group, Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
8
by: elias.farah | last post by:
Hello Everyone, I'm having some very weird behavior on a couple of Access forms. (Not all forms, just some of them). The forms have been working for years, under Access XP/2003 etc, and last...
5
by: colin spalding | last post by:
How do I design a totals query that instead of the following result YearOfAcc PremiumGBP 2004 9,142,306.95 2004 1,481,153.21 2005 11,981,987.85 2006 20,653,195.20 2006 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.