Go Back   PCMech Forums > Help & Discussion > Software Discussion & Support

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 09-29-2003, 11:17 AM   #1
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Access Reports

You can download a copy of the database from: www.hrocupload.co.uk/dj4uk/Timebase.mdb

I need some help with reports. If you take a look at the report "Detailed Costings Grouped by Month" you can see it produces a report with total hours for each job for each member of staff. This is fine but I'd also like to add a total for the entire job like so:

Staff Member Total Hours on this Job
Debbie 15.5
David 5.5
Total: 21

Has anyone got any idea how I could do this?

Regards

DJ
dj4uk is offline   Reply With Quote
Old 09-29-2003, 11:27 AM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Add a footer for the Job grouping. Copy the totalDuration textbox from the Detail section to the Job footer. Change the Control Source to "=Sum([totalDuration])"

That should do it.
doctorgonzo is offline   Reply With Quote
Old 09-29-2003, 11:30 AM   #3
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
I've got you with the "=SUM(totalDuration)" but how do I add a footer to the job grouping? I can't find anyway to do this.

DJ
dj4uk is offline   Reply With Quote
Old 09-29-2003, 11:35 AM   #4
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Right click on the report and go to "Sorting and Grouping". Go to the Job line, and there are options that allow you to select whether each grouping will have a header or footer.
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 03:57 AM   #5
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Fantastic it worked! Thanks!

Now I've just got to work out how to reformat a number into a currency format. Don't know of any good reference websites for access?

Thanks again.

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 04:02 AM   #6
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Forget my last post - managed to format to currency.

Cheers!

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 09:32 AM   #7
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
OK new problem. This ones a bit difficult to explain.

I want to populate a textbox in a report with a value from a table query however I want the query to be conditional on the data in the report. Can anyone point me in the direction of how to do this? Can I reference report data in any way?

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 09:40 AM   #8
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
What data do you need from the report, and why can't you just put it in a query? Technically, you can reference data from an (open) report and use it elsewhere, but that is a pretty ineffective solution. Just use a query.
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 09:44 AM   #9
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Well my report is built on a query but I can for the life of me get the additional field I need into the query - its a tad complex:

SELECT c.Client, p.Name AS Job,
p.JobNumber,
s.Full_Name,
w.Month AS MonthID,
m.Month,
w.Year,
(m.Month & " " & w.Year) AS FullDate,
SUM(e.Duration) AS totalDuration
FROM tbl_entry_log AS e,
tbl_week_numbers AS w,
tbl_staff AS s,
tbl_projects AS p,
tbl_clients AS c,
tbl_months AS m
WHERE e.Entry_date Between dateadd("d",-6,w.EndDate)
And w.EndDate And e.StaffID=s.UserID
And p.ProjectID=e.ProjectID
And p.ClientID=c.ClientID
And w.Month=m.MonthID
GROUP BY c.Client, p.Name, p.JobNumber, s.Full_Name, w.Month, m.Month, w.Year
ORDER BY w.Year DESC , w.Month DESC , c.Client, p.JobNumber;

I need to get the Maximum EndDate (MAX(w.EndDate)) for the monthID (w.Month).

Just ain't playing ball. I'll upload the database again if you need it.

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 10:06 AM   #10
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Why don't you upload it again and I will play around with it.
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 10:11 AM   #11
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Ok its up same URL as before.

Thanks for all your help on this by the way.
dj4uk is offline   Reply With Quote
Old 09-30-2003, 10:32 AM   #12
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Okay, let me see if I understand this.

The query shows the Client, Job, JobNumber, FullName, MonthID (and then the Month), Year, FullDate (Month + Year), and the duration. You want to add the MaxEndDate for every month. So, for all the records in October, you want to have the MaxEndDate for month 10, for the records for September, you want to have the MaxEndDate for month 9, and so on. The MaxEndDate will be the same for every record with that month, so the MaxEndDate for the first four records in that query, because they are all in the month of October, should be the same (and 11/02/03, if I am seeing this right).

Is this correct?
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 10:36 AM   #13
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Yep you got it!
dj4uk is offline   Reply With Quote
Old 09-30-2003, 10:42 AM   #14
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Okay, then I think I have what you want.

First, I created a separate query that will generate the MaxEndDate. It is called qryMaxEndDate, and this is it:

SELECT Max(tbl_week_numbers.EndDate) AS MaxEndDate, tbl_week_numbers.Month
FROM tbl_months INNER JOIN tbl_week_numbers ON tbl_months.MonthID = tbl_week_numbers.Month
GROUP BY tbl_week_numbers.Month;

Then, I changed the Detailed Costings query to look like this:

SELECT c.Client, p.Name AS Job, p.JobNumber, s.full_name, w.Month AS MonthID, m.Month, w.Year, (m.Month & " " & w.Year) AS FullDate, Sum(e.Duration) AS totalDuration, qryMaxEndDate.MaxEndDate
FROM (tbl_projects AS p INNER JOIN (tbl_entry_log AS e INNER JOIN tbl_staff AS s ON e.StaffID = s.UserID) ON p.ProjectID = e.ProjectID) INNER JOIN tbl_clients AS c ON p.ClientID = c.ClientID, qryMaxEndDate INNER JOIN (tbl_months AS m INNER JOIN tbl_week_numbers AS w ON m.MonthID = w.Month) ON qryMaxEndDate.Month = w.Month
WHERE (((e.Entry_Date) Between DateAdd("d",-6,[w].[EndDate]) And [w].[EndDate]))
GROUP BY c.Client, p.Name, p.JobNumber, s.full_name, w.Month, m.Month, w.Year, qryMaxEndDate.MaxEndDate
ORDER BY w.Year DESC , w.Month DESC , c.Client, p.JobNumber;

You probably noticed that instead of all of the WHERE clauses, I used JOIN syntax instead. When you are using tables that have relationships between each other, it is better to use JOINs that WHERE clauses. However, the end result is the same.
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 10:48 AM   #15
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
I usually use the JOIN syntax but didn't have a way to join tbl_week_numbers. I didn't think of joining through tbl_months as I added this later and just as a lookup table. Amazing what getting another fresh pair of eyes does!

Also didn't realise you could join queries in Access - learn a new thing every day!

Thanks for that! I'll give it a go.

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 10:58 AM   #16
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
It worked perfectly thanks loads!
dj4uk is offline   Reply With Quote
Old 09-30-2003, 11:15 AM   #17
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
OK not quite perfectly - but this is my fault rather than a problem with the query.

I've made some changes to the report but when you view it there are extra pages with small bit of grey on them (look like the end of the client headings). Now they are there I can seem to get rid of them. Must be a width problem - but I can't find where.

I've uploaded the new version.

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 11:19 AM   #18
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
I'm not getting any extra pages. I only get three, and they all have info.

Very nice layout, by the way. It looks excellent.
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 11:23 AM   #19
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
You don't get extra pages? hmmmm weird - does it have the month ends bit right at the top of pages?

Thanks! Its the first report I've ever done so it been quite a learning curve.
dj4uk is offline   Reply With Quote
Old 09-30-2003, 11:44 AM   #20
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Nope, no extra pages, and it does have the month end up in the upper right-hand corner.

It may be a page setup problem or a margin problem. Maybe if you reduced the margins slightly it would go away.
doctorgonzo is offline   Reply With Quote
Old 09-30-2003, 02:15 PM   #21
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
Ok I'll try that.

Thanks again for all your help - give me a shout if you are ever in Birmingham, UK - I'll buy you a drink!

DJ
dj4uk is offline   Reply With Quote
Old 09-30-2003, 02:27 PM   #22
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Birmingham is a long way from St. Paul, but if I am ever there I will keep that in mind!
doctorgonzo is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:26 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2