Access Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pukhton
    New Member
    • Jun 2007
    • 75

    Access Report

    I have a question; see if someone can help me out. I want a run a report in access

    “By Type by Location”

    Type is the drug name and location is the physical location. What I want to do is count the location and group by Type, and add the total number of location by each Type and put it under Type.

    That’s what I have so far, and its working fine, but I am not getting the total number of location and place it under Type.

    [CODE=TEXT]

    PARAMETERS [Start Date] DateTime, [End Date] DateTime;
    SELECT Intervensions1.[Type of Intv], Intervensions1. Location, Count(Intervens ions1.fldID) AS CountOffldID
    FROM Intervensions1
    WHERE (((Intervension s1.Date) Between [Start Date] And [End Date]))
    GROUP BY Intervensions1.[Type of Intv], Intervensions1. Location
    ORDER BY Intervensions1.[Type of Intv];

    [/CODE]



    Thanks for your help.
  • pukhton
    New Member
    • Jun 2007
    • 75

    #2
    I think i have resolved that issude by making a new query, but now i want to have these two quries in the same report. Is it possible?

    Here is query 1 for by type and by location.

    [CODE=TEXT]

    PARAMETERS [Start Date] DateTime, [End Date] DateTime;
    SELECT Intervensions1.[Type of Intv], Intervensions1. Location, Count(Intervens ions1.fldID) AS CountOffldID
    FROM Intervensions1
    WHERE (((Intervension s1.Date) Between [Start Date] And [End Date]))
    GROUP BY Intervensions1.[Type of Intv], Intervensions1. Location
    ORDER BY Intervensions1.[Type of Intv];

    [/CODE]

    and here is the query 2 which will sum the CountOffldID for each type.

    [CODE=TEXT]

    SELECT [By Interventions & by Location].[Type of Intv], Sum([By Interventions & by Location].CountOffldID) AS SumOfCountOffld ID
    FROM [By Interventions & by Location]
    GROUP BY [By Interventions & by Location].[Type of Intv]
    ORDER BY [By Interventions & by Location].[Type of Intv];

    [/CODE]

    so I want my report where i can have both the quries together in the same report.

    Let me give you in example of the report i am looking for.

    [CODE=TEXT]

    Interventions Type Location CountOffldID

    Consultation 10 SOUTH 2
    Consultation ICU 2

    So i want SumOfCountoffld ID = 4
    [/CODE]

    help please.

    Comment

    • pukhton
      New Member
      • Jun 2007
      • 75

      #3
      Originally posted by pukhton
      I think i have resolved that issude by making a new query, but now i want to have these two quries in the same report. Is it possible?

      Here is query 1 for by type and by location.

      [CODE=TEXT]

      PARAMETERS [Start Date] DateTime, [End Date] DateTime;
      SELECT Intervensions1.[Type of Intv], Intervensions1. Location, Count(Intervens ions1.fldID) AS CountOffldID
      FROM Intervensions1
      WHERE (((Intervension s1.Date) Between [Start Date] And [End Date]))
      GROUP BY Intervensions1.[Type of Intv], Intervensions1. Location
      ORDER BY Intervensions1.[Type of Intv];

      [/CODE]

      and here is the query 2 which will sum the CountOffldID for each type.

      [CODE=TEXT]

      SELECT [By Interventions & by Location].[Type of Intv], Sum([By Interventions & by Location].CountOffldID) AS SumOfCountOffld ID
      FROM [By Interventions & by Location]
      GROUP BY [By Interventions & by Location].[Type of Intv]
      ORDER BY [By Interventions & by Location].[Type of Intv];

      [/CODE]

      so I want my report where i can have both the quries together in the same report.

      Let me give you in example of the report i am looking for.

      [CODE=TEXT]

      Interventions Type Location CountOffldID

      Consultation 10 SOUTH 2
      Consultation ICU 2

      So i want SumOfCountoffld ID = 4
      [/CODE]

      help please.
      Can some one help me out please???

      Comment

      • cyberdwarf
        Recognized Expert New Member
        • Nov 2006
        • 218

        #4
        Have you thought of using the totalling/subtotalling facility of Access reports to simplify your query complications?

        HTH

        Steve

        Comment

        • pukhton
          New Member
          • Jun 2007
          • 75

          #5
          Originally posted by cyberdwarf
          Have you thought of using the totalling/subtotalling facility of Access reports to simplify your query complications?

          HTH

          Steve
          No, Dont know this option in Accesss. How do you do it by the way?

          Thanks

          Comment

          • Jim Doherty
            Recognized Expert Contributor
            • Aug 2007
            • 897

            #6
            Originally posted by pukhton
            Can some one help me out please???
            Are you not in a position to use the grouping elements of a report to group by intervntion,typ e and location then merely use a textbox in the group footer to sum the count of fldID? ie:

            =Sum(countoffld id)

            That way you would have no need for the second query if I am reading you right!?

            Regards

            Jim

            Comment

            • pukhton
              New Member
              • Jun 2007
              • 75

              #7
              Originally posted by Jim Doherty
              Are you not in a position to use the grouping elements of a report to group by intervntion,typ e and location then merely use a textbox in the group footer to sum the count of fldID? ie:

              =Sum(countoffld id)

              That way you would have no need for the second query if I am reading you right!?

              Regards

              Jim
              Yes Jim you r right but i want total by each type rather than the whole sum of all the types.

              Thanks

              Comment

              • Jim Doherty
                Recognized Expert Contributor
                • Aug 2007
                • 897

                #8
                Originally posted by pukhton
                Yes Jim you r right but i want total by each type rather than the whole sum of all the types.

                Thanks
                As cyberdwarf pointed out (and I missed that posting..must be blind sorry cyber am repeating your advice here) you really need to get your head round reports sorting and grouping that is what it is there for. May I suggest you create a simple report based on your first query and disregard the second query.

                When you have done that have a look at the sorting and grouping methods for reports. You cannot really progress further until you know the concepts of these..... otherwise you will be creating unnecessary queries for yourself when,.... the report can already do much of what might be thinking "hmmmmm I need a query for that!"

                Now if this were SQL server I'd be saying to you yeah we can get all of this in one query using rollup and cube etc but its not its Access sooo..

                Given you said you don't know how to work sorting and grouping in reports I think that is much more important to understand that as is, currently, than to bash away at the query side. I think you,ll agree with me when you get there?!

                Sorting and grouping is accesed via the VIEW.. SORTING and GROUPING menubar command in the design view of any report

                Regards

                Jim

                Comment

                Working...