Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / June 2006

Tip: Looking for answers? Try searching our database.

Creating a report horizontally, sort of...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luna Saisho - 22 Jun 2006 23:34 GMT
I just got some wonderful help in another problem from two people, and I
wanted to say thank you!  ^_^

Of course, though, I do have another issue on something I don't even know if
Access can do.

Anyway, as before, I'm working on a database to keep track of employee
vacation time in our warehouse.  I have just about everything completed, but
I am stuck.  

Is it possible to create a report that would list calendar days 1-31 in one
line across, and underneath, have a listing of all employees, and an X or
their hours taken that day listed?  Kind of like this:

Jan: 1  2  3  4  ... 29  30  31
Bob: -  -  X  X  ...
Tim: X  -  -  -  ...

Sitting here working on everything else, I'm not even sure if that's possible.

Thank you for your time!
Stephanie
Allen Browne - 23 Jun 2006 02:20 GMT
You can do that with a crosstab query.
The "how" depends on how you store the data.

Can we assume you have a table something like this:
   WorkID              primary key
   EmployeeID      relates to Employee.EmployeeID
   ShiftDate           Date/Time
   HoursWorked   Number

1. Create a query using this table and your employee table.
There should be a line joining the 2 tables on the EmployeeID fields.

2. Change it to a crosstab (Crosstab on Query menu.)
Access adds 2 rows to the design grid (Total and Crosstab.)

3. In the Field row, type:
       TheYear: Year([ShiftDate])
In the Crosstab row, choose Row Heading.

4. In the next column in the field row, type:
       TheMonth: Month([ShiftDate])
In the Crosstab row, choose Row Heading.

5. In the next column in the field row, type:
       TheDay: Day([ShiftDate])
In the Crosstab row, choose Column Heading

6. Add the Employee name field to the grid (from the Employee table.)
In the Crosstab row, choose Row Heading.

7. Add the HoursWorked field to the grid.
In the Crosstab row, choose Value.
In the Total row, choose Sum.

8. Open the Properties box (View menu.)
In the Column Headings property, enter a list of numbers from 1 to 31:
   1,2,3,...
(If you don't see the property, you are looking at the properties of a field
instead of the properties of the query.)

The query now shows:
- a column for the year (step 3), month (step 4), and employee (step 6);
- a column for each day from 1 to 31 (steps 6 and 8);
- the sum of hours at the intersection point.

You can now build a report from this query.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I just got some wonderful help in another problem from two people, and I
> wanted to say thank you!  ^_^
[quoted text clipped - 22 lines]
> Thank you for your time!
> Stephanie
Luna Saisho - 23 Jun 2006 19:05 GMT
Thank you Allen!  I will give it a try a little later on today and see how it
works out.

Your guess on how my table is set up is very close, enough that I should be
able to adapt it pretty easily.

Thank you again!
Stephanie

> You can do that with a crosstab query.
> The "how" depends on how you store the data.
[quoted text clipped - 69 lines]
> > Thank you for your time!
> > Stephanie
Luna Saisho - 26 Jun 2006 23:06 GMT
Hi Allen,

I wasn't able to log in on Friday to let you know how it went, as our entire
plant lost Internet for a good majority of the night.  

I do, however, need to thank you!  I tried what you told me, and it works
like a charm!  I was unsure what to do with it at first, but when I went and
set the query as the data source, and saw how the fields came up, it was
obvious.  It re-creates their Excel based ones in reports, but now they can
get the info they need, and modify it, a lot easier.

The only odd thing is it changed "TheDay: Day([ShiftDate])" to "Expr1:
Day([Dates])" but as I need to work on a Monthly basis, it hasn't been an
issue.

If Microsoft has done anything in this world right, it was to create these
newsgroups!  My thanks go out to you, Allen, and the many people that have
helped me in the past month.  THANK YOU!  ^_^

> You can do that with a crosstab query.
> The "how" depends on how you store the data.
[quoted text clipped - 69 lines]
> > Thank you for your time!
> > Stephanie
Allen Browne - 27 Jun 2006 04:41 GMT
The alias (Expr1 or TheDay) does not matter.
If the field is named Dates rather than ShiftDate, the expresion is correct.

That's a beautiful expression of appreciation, Stephanie.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi Allen,
>
[quoted text clipped - 95 lines]
>> > Thank you for your time!
>> > Stephanie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.