Results 1 to 7 of 7
  1. #1
    Hediru is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2014
    Posts
    8

    Question Inverting table data for a report


    I had trouble coming up with a title for this post because my question is complicated. I am a children's pastor at a church, and I am creating a database from scratch to manage my volunteers. Here's what I am trying to do. I have a table that lists my acolytes. I would like to create a table or form that allows me to assign each acolyte to a date and then print out a report that shows who is serving on what date. For example:

    Click image for larger version. 

Name:	screenshot.png 
Views:	8 
Size:	10.3 KB 
ID:	19012

    Report:
    Date - Acolyte Name

    January 4, 2015 - Susie Acolyte
    January 11, 2015 - Joey Acolyte

    Is this possible? I already have a table like what is shown above with yes/no check boxes for all of the possible dates if that's any help. Is there a way to invert the data for the report?
    Last edited by Hediru; 12-09-2014 at 04:00 PM. Reason: screenshot added

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You have a yes/no field for each date? This is not a normalized data structure. Normalizing would mean another table with a record for each Acolyte name and date combination and a form/subform arrangement for data entry.

    Generating that output with current structure could be done with a UNION query. There is no wizard or builder for UNION query, must type into SQL View of query designer. There is a limit of 50 SELECT lines in UNION.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Hediru is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2014
    Posts
    8
    I had had the yes/no field for each date so that I could create a form that allowed me to access each acolyte and check the boxes for the dates that they are serving without having to sit there and think "ok, what are the dates of the Sundays in January?" if you have a better idea of how I can do this with a more normalized data structure, I am all ears!

    I'm also not familiar with UNION queries. Where can I find a tutorial? I'm self taught on the program and have been able to do a lot with it, just can't figure out how to assign dates to the students and then create the report that I want. Thanks for your help!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    A good start for learning SQL http://www.w3schools.com/SQl/sql_union.asp

    The examples show UNION of two tables, but the same technique can be used for fields from same table. The first SELECT line sets the field names, so can use an alias to reassign a field name.

    SELECT AcolyteID, [First Name], [Last Name], #1/4/2015# AS DateWork FROM Acolytes WHERE [January 4, 2015]=True
    UNI ON SELECT AcolyteID, [First Name], [Last Name], #1/11/2015# AS DateWork FROM Acolytes WHERE [January 11, 2015]=True
    ... ;

    Does this give you some idea of why non-normalized structure is fraught with problems? Better design would be the related tables I described with a combobox listing the Sunday dates to choose from. The combobox RowSource can come from a table or can be generated by VBA code.


    Advise no spaces or special characters/punctuation (underscore is exception) in naming convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Hediru is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2014
    Posts
    8
    Ironically, I had done the combo box row source originally. Leave it to me to make things more complicated. Ok. So once I convert this back to the combo box, I can use the UNION table to make a query to base my report on? And will it parse out the separate dates? (ex: Susie Acolyte serves on Jan 4 and Mar 8. Would the resulting report list her both on Jan 4 and Mar 8?) Thanks for helping me with what may seem like dumb questions.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    How does combobox help if you still have the same table structure?

    Yes, UNION query will show both records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Hediru is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2014
    Posts
    8
    Ok. I think I get it! Thanks for your prompt help! I will mark this thread as resolved. I'll post a new thread if I have additional questions.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Inverting Columns and Rows in Query
    By jlclark4 in forum Queries
    Replies: 1
    Last Post: 05-28-2013, 12:00 PM
  2. Prob with getting data into a report / table
    By winterh in forum Reports
    Replies: 1
    Last Post: 05-14-2012, 01:35 PM
  3. Report from a data logging table
    By chrismec in forum Reports
    Replies: 1
    Last Post: 02-29-2012, 01:03 PM
  4. updating existing report with new data in table
    By newtoaccess123 in forum Reports
    Replies: 2
    Last Post: 10-18-2011, 09:50 AM
  5. Populating Table with data from Report
    By bubba55 in forum Access
    Replies: 10
    Last Post: 08-22-2011, 11:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums