Results 1 to 4 of 4
  1. #1
    exupery is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    2

    Lightbulb enter parameter value dialog box

    Hello, if I open a query, wild parameter value boxes (4) appears and I dont want them. I know, where is the problem, but reason is secret for me.

    SQL:
    SELECT Year([sdd]) AS [Year], Month([sdd]) AS [Month], tab_sqm_data_my_supplier.[Reporting unit], tab_sqm_data_my_supplier.Plant, tab_sqm_data_my_supplier.[Supplier code], tab_sqm_data_my_supplier.[Supplier name], Sum(tab_sqm_data_my_supplier.[Sum of exp# qty]) AS [SumOfSum of exp# qty], Sum(tab_sqm_data_my_supplier.Penalty) AS SumOfPenalty, Avg(tab_sqm_data_my_supplier.[Overdue days]) AS [AvgOfOverdue days], Sum(tab_sqm_data_my_supplier.[Overdue qty]) AS [SumOfOverdue qty], IIf([COT]<[COT Alarm],"Alarm",IIf(([COT]>=[COT Alarm]) And ([COT]<[COT target]),"OK","TargetOK")) AS [COT status], tab_supplier_db.[COT Alarm], tab_supplier_db.[COT target], tab_supplier_db.Measured, tab_sqm_data_my_supplier.[COT formula], Avg(tab_sqm_data_my_supplier.[COT (%)]) AS [AvgOfCOT (%)], IIf([COT formula]="type1",[avgofCOT (%)],(1-([SumOfOverdue qty]/[SumOfSum of exp# qty]))*100) AS COT
    FROM tab_supplier_db INNER JOIN tab_sqm_data_my_supplier ON tab_supplier_db.[Supplier_name] = tab_sqm_data_my_supplier.[Supplier name]
    GROUP BY Year([sdd]), Month([sdd]), tab_sqm_data_my_supplier.[Reporting unit], tab_sqm_data_my_supplier.Plant, tab_sqm_data_my_supplier.[Supplier code], tab_sqm_data_my_supplier.[Supplier name], IIf([COT]<[COT Alarm],"Alarm",IIf(([COT]>=[COT Alarm]) And ([COT]<[COT target]),"OK","TargetOK")), tab_supplier_db.[COT Alarm], tab_supplier_db.[COT target], tab_supplier_db.Measured, tab_sqm_data_my_supplier.[COT formula], IIf([COT formula]="type1",[AvgOfCOT (%)],(1-([SumOfOverdue qty]/[SumOfSum of exp# qty]))*100)
    HAVING (((tab_sqm_data_my_supplier.[COT formula])>"0"))
    ORDER BY Year([sdd]) DESC , Month([sdd]) DESC , tab_sqm_data_my_supplier.[Supplier name];



    bold values are parameter values and I know, if I use they in the same SQL like this, they will appears.

    So the question is, how to change this code with no PV reason.

    At the end, sorry for my english.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    You get params asked if:
    a field does not exist in the table,
    A field you think exists, but is misspelled.

    You cannot use a field you created in the query in an expression in the same query....
    Sum(field), 1-(SumOfField) as new field

    Note: Dont put spaces in Field labels. It could introduce problems.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Build a report and do those secondary calcs in textboxes.

    Also advise not to use punctuation and special characters (underscore only exception) in names.
    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.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by ranman256 View Post
    .
    You cannot use a field you created in the query in an expression in the same query....
    Sum(field), 1-(SumOfField) as new field.
    Well, sometimes you can. Typically the problem arises when you try to use an aliased field in the WHERE or GROUP BY clause, due to the order in which clauses are evaluated.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 09-01-2016, 11:00 AM
  2. Replies: 2
    Last Post: 05-20-2015, 08:26 AM
  3. Replies: 4
    Last Post: 09-09-2013, 05:34 AM
  4. Replies: 3
    Last Post: 01-03-2013, 04:32 PM
  5. Replies: 13
    Last Post: 01-10-2012, 09:56 AM

Tags for this Thread

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