Results 1 to 3 of 3
  1. #1
    BradBrad is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2011
    Posts
    2

    Smile Multi-Query Error?

    Hi All,



    I'm querying 2 tables and one query to create a "summary" page for a client.

    I'm having some difficulties however, with the dates. I want to prompt the user to type in one month in the form mm/yyyy and then that will filter the results of the calculations below based on the month entered.

    Any ideas?

    Here's the updated code:


    Code:
     SELECT [Influent Data - Monthly Summary Sheet].[SumOfTotal Flow (m3/day)]/1000 AS [Total Flow], [R1 Data By Month].[Total Flow]/[Influent Data - Monthly Summary Sheet].[SumOfNumber of Samples] AS [Average Total Flow], Max([Influent Data].[Max Flow (m3/day)]/1000) AS [MaxOfMax Flow (m3/day)], Avg([Influent Data].[BOD5]) AS Expr1, Avg([Influent Data].[Susp Solids (mg/L)]) AS [AvgOfSusp Solids (mg/L)], Avg([Influent Data].[Ammonia (mg/L)]) AS [AvgOfAmmonia (mg/L)], Avg([Influent Data].[Phosphorus (mg/L)]) AS [AvgOfPhosphorus (mg/L)], Sum([Final Effluent Data].[Chlorine Used]) AS [SumOfChlorine Used], Avg([Final Effluent Data].[Chlorine Dosage]) AS [AvgOfChlorine Dosage], Avg([Final Effluent Data].[Chlorine Residual]) AS [AvgOfChlorine Residual], Avg([Final Effluent Data].BOD) AS AvgOfBOD, Avg([Final Effluent Data].[Susp Solids (mg/L)]) AS [AvgOfSusp Solids (mg/L)1], Avg([Final Effluent Data].[Ammonia (mg/L)]) AS [AvgOfAmmonia (mg/L)1], Avg([Final Effluent Data].TKN) AS AvgOfTKN, Avg([Final Effluent Data].[Phosphorus (mg/L)]) AS [AvgOfPhosphorus (mg/L)1]
    FROM [Return Sludge Data], [Influent Data], [Final Effluent Data], [Influent Data - Monthly Summary Sheet]
    GROUP BY [Influent Data - Monthly Summary Sheet].[SumOfTotal Flow (m3/day)]/1000, [R1 Data By Month].[Total Flow]/[Influent Data - Monthly Summary Sheet].[SumOfNumber of Samples], Format([Influent Data].[The Date],"mm/yyyy"), Format([Final Effluent Data].[The Date],"mm/yyyy")
    HAVING (((Format([Influent Data].[The Date],"mm/yyyy"))=[Choose a Month - Format: mm/yyyy])) OR (((Format([Final Effluent Data].[The Date],"mm/yyyy"))=[R1 Data by Month].[The Date]));

    Now the dates are messing up.. I want the queries to use the same date but only have one prompt box. Any ideas?

  2. #2
    BradBrad is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2011
    Posts
    2
    Updated Code:

    Code:
     SELECT [Influent Data - Monthly Summary Sheet].[SumOfTotal Flow (m3/day)]/1000 AS [Total Flow], ([Influent Data - Monthly Summary Sheet].[SumOfTotal Flow (m3/day)]/1000)/[Influent Data - Monthly Summary Sheet].[SumOfNumber of Samples] AS [Average Total Flow], Max([Influent Data].[Max Flow (m3/day)])/1000 AS [MaxOfMax Flow (m3/day)], Avg([Influent Data].[BOD5]) AS Expr1, Avg([Influent Data].[Susp Solids (mg/L)]) AS [AvgOfSusp Solids (mg/L)], Avg([Influent Data].[Ammonia (mg/L)]) AS [AvgOfAmmonia (mg/L)], Avg([Influent Data].[Phosphorus (mg/L)]) AS [AvgOfPhosphorus (mg/L)], Sum([Final Effluent Data].[Chlorine Used]) AS [SumOfChlorine Used], Avg([Final Effluent Data].[Chlorine Dosage]) AS [AvgOfChlorine Dosage], Avg([Final Effluent Data].[Chlorine Residual]) AS [AvgOfChlorine Residual], Avg([Final Effluent Data].BOD) AS AvgOfBOD, Avg([Final Effluent Data].[Susp Solids (mg/L)]) AS [AvgOfSusp Solids (mg/L)1], Avg([Final Effluent Data].[Ammonia (mg/L)]) AS [AvgOfAmmonia (mg/L)1], Avg([Final Effluent Data].TKN) AS AvgOfTKN, Avg([Final Effluent Data].[Phosphorus (mg/L)]) AS [AvgOfPhosphorus (mg/L)1]
    FROM [Influent Data], [Final Effluent Data], [Influent Data - Monthly Summary Sheet]
    HAVING (((Format([Influent Data].[The Date],"mm/yyyy"))=[Choose a Month - Format: mm/yyyy])) OR (((Format([Final Effluent Data].[The Date],"mm/yyyy"))=[Influent Data].[The Date]));

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Did you fix your problem or are you still having an issue? If you still have a problem could you post a sample db

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

Similar Threads

  1. Multi Criteria Query
    By hawkins in forum Queries
    Replies: 1
    Last Post: 07-18-2011, 01:44 PM
  2. Replies: 11
    Last Post: 07-17-2011, 08:56 PM
  3. Replies: 1
    Last Post: 12-16-2010, 10:32 AM
  4. Multi-Filter Query
    By jgelpi16 in forum Queries
    Replies: 3
    Last Post: 12-03-2010, 11:08 AM
  5. Replies: 1
    Last Post: 02-25-2009, 07:29 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