Results 1 to 13 of 13
  1. #1
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15

    Access report header and sorting

    Hi there,

    I am working on a access report for financial analysis, I am wondering if anyone would help me with following questions.

    I created a form with a drop down list to select cost center from tables, so the report will only show the data from the selected cost center. My questions are:

    1. I want the chosen cost center automatically shown at the Header of the report, as selected from the form;

    2. The data was grouped in a particular sequence, such as: Revenue, Compensation, MM&S and Other Expense, not simply ascending or descending

    3. There are some category data I do not want to show, for example, other expense, how can I hide it?



    Would anyone please share your thought? I would be greatly appreciated!

    Thanks,

    Luna

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    1. several ways you can get it there.
    a. include the cost center description in the query driving your report and put that field in your report header
    b. put a text box on your report and put the formula =[forms]![formname]![comboboxname].column(x)

    where formname is the name of your form
    comboboxname is the name of your combo box
    and x is the column (remember combo boxes are 0 indexed so if the cost center is the 2nd physical column it's index is 1) where the cost center name appears


    2. What is the question here, whether you can re-order or change grouping schemes?

    3. If you are talking about the combo box on your form, in other words you want to deny your users the ability to look at certain cost centers you can do this a couple of ways

    a. Simply put a critera on your cost center PK of <> CC_ID where CC_ID is the PK of your cost center
    b. Modify the table that has your cost centers and add a field "DoNotShow" or something like that as a yes/no field and put a check in the cost centers you don't want to show, then in the query driving your combo box put a criteria in the "DoNotShow" field of <> -1

  3. #3
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Thanks, rpeare,

    I fixed the first question by simply add a text box in the header.

    The 2nd question is I want to re-order the rows in the reports, but the simple ascending and descending is not satisfying. Do you know how to sort the data according to a specific order?

    Thanks,

    Luna

  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
    If Revenue, Compensation, MM&S, Other Expense are values in a single field and you want to sort in that order, options:

    1. have table of these values with a field for a sort value (1, 2, 3, etc) and include this table in the report RecordSource

    2. create another field in query or report Sorting & Grouping design that calculates a value to sort by:

    Switch([fieldname]="Revenue", 1, [fieldname]="Compensation", 2, [fieldname]="MM&S", 3)

    If you don't want to include Other Expense records then apply filter criteria: <> "Other Expense"
    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
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Thanks June7.

    Your explain is very clear. So the Access can only recognize Ascending or Descending, we have to create another line for the sorting.

  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
    Basically, yes. What other type of sorting could you envision?
    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
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    I was expecting something like we could do with Excel, customize the sorting.

    I have another question.

    Is there a way you would let the user chose which field to show?

    I have a table with data for different cost centers, we have data for 12 months, both Actual cost and budgeted cost. What I would like to have is,

    If the user chose May, I would have a report to show May Actual Data, May Budget Data, Variance, May Year to Data Data, and maybe May last year's data from a different table.

    Click image for larger version. 

Name:	Current data.jpg 
Views:	9 
Size:	18.1 KB 
ID:	21755

    Thank you for your thought!

    Luna
    Attached Thumbnails Attached Thumbnails rows to show.jpg  

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Excel is still sorting ascending or descending - whether alphabetic or numeric, can be only ascending or descending.

    If you want to show only May records then apply filter criteria.
    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.

  9. #9
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Hi June7,

    We can customize sorting on Excel, please see attached pic to sorting data in accordance with weekdays, Months or anything you want.

    Click image for larger version. 

Name:	Excel sorting.jpg 
Views:	9 
Size:	81.5 KB 
ID:	21762

    Maybe I do not make myself clear. May data is a column, every month's data is a field. To my understanding, filter criteria can only apply on rows.

    Correct me if I was wrong.



  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Okay, I've never played with Excel OrderList. Interesting. I suspect what you don't see Excel doing is assigning a numeric value to each item in the list and using that 'behind the scenes' to sort by or some other complex algorithm I can't begin to envision.

    No, Access does not make so simple. What is not visible to you in Excel you must consciously construct in Access. Define a field for sort order and apply ascending or descending parameter.

    A field for each month means your data structure is not normalized - you are 'committing spreadsheet'. This will likely give you lots of frustration in Access.

    A query cannot be dynamic for selection of fields, only 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.

  11. #11
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    I am new to Access, that's why I post the questions, am I.

    So when you say normalize, do you mean to structure data like:

    Click image for larger version. 

Name:	12.jpg 
Views:	8 
Size:	33.3 KB 
ID:	21763

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Yes. That allows filtering records on month values. Then if you want to view output of months horizontally, that would be a CROSSTAB query.
    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.

  13. #13
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    That really helps June7!

    Many thanks!

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

Similar Threads

  1. Replies: 1
    Last Post: 08-11-2015, 11:33 AM
  2. Multiple Group Header Sorting via VBA
    By rsarracini in forum Programming
    Replies: 4
    Last Post: 05-13-2014, 01:57 PM
  3. Changing Font in Access Report Header
    By ZLHysong in forum Access
    Replies: 1
    Last Post: 02-01-2013, 03:17 PM
  4. Replies: 6
    Last Post: 08-07-2012, 03:25 PM
  5. Access report with 3 tables -grouping,sorting
    By kartechy in forum Reports
    Replies: 0
    Last Post: 07-22-2009, 09:07 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