Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    john134 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    42
    I forgot to include the database. However, I am having trouble attaching it.


    I can send it to your email address if you want.

  2. #17
    Join Date
    Apr 2017
    Posts
    1,792
    And again you haven't used parameters in your query example at all! Logically you must have someting like;

    PARAMETERS [Start Date] DateTime, [End Date] DateTime;
    SELECT DISTINCT [Individual Donor Table].[Full Name], Sum([Individual Gift Amount Table].[Gift Amount]) AS [SumOfGift Amount]
    FROM [Individual Donor Table] INNER JOIN [Individual Gift Amount Table] ON [Individual Donor Table].[Full Name]=[Individual Gift Amount Table].[Full Name]
    WHERE [Individual Gift Amount Table].[SomeDateField] > [Start Date] AND [Individual Gift Amount Table].[SomeDateField] < [End Date]
    GROUP BY [Individual Donor Table].[Full Name]
    UNION SELECT DISTINCT [Organization Donor Table].[Org Name], Sum([Organization Gift Amount Table].[Gift Amount]) AS [SumOfGift Amount]
    FROM [Organization Donor Table] INNER JOIN [Organization Gift Amount Table] ON [Organization Donor Table].[Org Name] = [Organization Gift Amount Table].[Organ Name]
    WHERE [Organization Donor Table].[SomeDateField] > [Start Date] AND [Organization Donor Table].[SomeDateField] < [End Date]
    GROUP BY [Organization Donor Table].[Org Name];

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by john134 View Post
    I forgot to include the database. However, I am having trouble attaching it.
    I can send it to your email address if you want.
    If you can't attach here after compact/repair and zipping, you can email it to:

    pbaldy
    gmail
    com
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    john134 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    42
    Quote Originally Posted by john134 View Post
    Here is the query:

    PARAMETERS [Start Date] DateTime, [End Date] DateTime;
    SELECT DISTINCT [Individual Donor Table].[Full Name], Sum([Individual Gift Amount Table].[Gift Amount]) AS [SumOfGift Amount]
    FROM [Individual Donor Table] INNER JOIN [Individual Gift Amount Table] ON [Individual Donor Table].[Full Name]=[Individual Gift Amount Table].[Full Name]
    GROUP BY [Individual Donor Table].[Full Name]
    UNION SELECT DISTINCT [Organization Donor Table].[Org Name], Sum([Organization Gift Amount Table].[Gift Amount]) AS [SumOfGift Amount]
    FROM [Organization Donor Table] INNER JOIN [Organization Gift Amount Table] ON [Organization Donor Table].[Org Name] = [Organization Gift Amount Table].[Organ Name]
    GROUP BY [Organization Donor Table].[Org Name];
    9/6/17
    The problem appears to have gone away. I added the following line to it:
    ORDER BY [SumOfGift Amount] DESC;

    Not sure if this is what made it work.

  5. #20
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Quote Originally Posted by john134 View Post
    9/6/17
    The problem appears to have gone away. I added the following line to it:
    ORDER BY [SumOfGift Amount] DESC;

    Not sure if this is what made it work.
    Again, unless at least one of [Individual Donor Table] or [Individual Gift Amount Table] or [Organization Donor Table] or [Organization Gift Amount Table] are in fact a query and not a table then you are not even using the parameters.

    To use parameters to filter by date would be something like this:
    Code:
    PARAMETERS StartDate DateTime, EndDate DateTime;
    
    SELECT *
    FROM MyTable
    WHERE MyTable.SomeDateField Between StartDate and EndDate
    The first "PARAMTERS" line just tells access that you intend on using the variables listed, but for them to actually have any effect on the query they need to be included somewhere in the sql statement below that line. If they are not included below, then you might as well just delete the first PARAMETERS line all together.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problem with parameter query
    By jake7363 in forum Queries
    Replies: 1
    Last Post: 04-22-2016, 04:55 PM
  2. Replies: 3
    Last Post: 06-18-2015, 01:57 PM
  3. Parameter query problem
    By chrisfl in forum Queries
    Replies: 1
    Last Post: 08-17-2013, 12:06 AM
  4. Query parameter problem
    By Rzadziu in forum Queries
    Replies: 3
    Last Post: 03-30-2012, 01:57 PM
  5. Custom Query Parameter Prompts-- Problem
    By tylerthompson in forum Forms
    Replies: 11
    Last Post: 07-07-2009, 10:28 PM

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