Results 1 to 10 of 10
  1. #1
    gtsolid is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    19

    Query with calculations


    I produced this script


    Code:
    SELECT Nuovo.Complessivo, Count(Nuovo.Complessivo) AS CountOfComplessivo, Sum(Nuovo.Importo) AS SumOfImporto
    FROM Nuovo
    WHERE Year([Nuovo.Data Spedizione])=2021
    GROUP BY Nuovo.Complessivo;
    But i notice Access is asking me a parameter when i run the query. If I introduce "1" in any case it works well (result are correct). Why do I get this behavior?

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Normally that implies that the field name Importo is an incorrect spelling?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    gtsolid is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    19
    It's correct, i double checked

  4. #4
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    257
    The following query
    Code:
    SELECT Nuovo.Complessivo, Count(Nuovo.Complessivo) AS CountOfComplessivo, Sum(Nuovo.Importo) AS SommaDiImporto
    FROM Nuovo
    WHERE Year([Data Spedizione])=2021
    GROUP BY Nuovo.Complessivo;
    returns the following result
    Click image for larger version. 

Name:	Immagine1.png 
Views:	21 
Size:	5.6 KB 
ID:	47119
    starting from these data
    Click image for larger version. 

Name:	Immagine2.png 
Views:	21 
Size:	6.9 KB 
ID:	47120

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    check the properties of your query. I'm guessing your query used to reference 'query1' but now does not do so, but whilst it did you filtered and/or sorted on the Importo field. If this is the case, just remove from properties

  6. #6
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Is Nuovo a table or another query?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    gtsolid is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    19
    Quote Originally Posted by Ajax View Post
    If this is the case, just remove from properties
    Where are the properties? do you mean right-click on the query and then "Object property"?

    Quote Originally Posted by Minty View Post
    Is Nuovo a table or another query?
    It's a table

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    Where are the properties?
    in query design - click the property sheet option on the ribbon.

    There are three different types of objects with properties - the tables/queries selected by the query, the columns created by the query and the query itself. Click on each to see the relevant properties for each type. To see the properties for the query itself, click anywhere in the query other than the selected tables/queries

  9. #9
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    After some sleep, a really simple solution would be to copy and paste the SQL (Which looks fine) into a new blank query.
    If you still get a problem there is something else at play here.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  10. #10
    gtsolid is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    19
    Quote Originally Posted by Minty View Post
    After some sleep, a really simple solution would be to copy and paste the SQL (Which looks fine) into a new blank query.
    that was the solution, thanks

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

Similar Threads

  1. VBA If/then calculations for Query
    By sciencegeek in forum Modules
    Replies: 7
    Last Post: 11-16-2016, 10:46 AM
  2. Replies: 30
    Last Post: 09-30-2015, 10:58 AM
  3. Calculations in a query
    By dichotomous2013 in forum Access
    Replies: 4
    Last Post: 02-19-2013, 06:55 AM
  4. Calculations in a query
    By bishop0071 in forum Queries
    Replies: 1
    Last Post: 01-27-2013, 03:54 PM
  5. Calculations in Query
    By jdhaldane in forum Queries
    Replies: 5
    Last Post: 12-10-2010, 05:57 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