Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011

    Unanswered: Two Questions regarding make table query


    I have a make table query below.

    SELECT Bulk_id_mapping.BulkID, Sum(import.[Premium Standard]+import.[Premium SubStandard]+import.[Flat Extra Premium]-import.[policy fee]) AS fyp, Sum(import.[Allowance Standard]+import.[Allowance SubStandard]+import.[Flat Extra Allowance]-import.[policy fee Allowance]+import.[Administration Fee Amount]) AS fya INTO firstyear1
    FROM Bulk_id_mapping INNER JOIN import ON Bulk_id_mapping.[Sage Treaty] = import.Treaty
    WHERE (((import.[Policy Duration])=1))
    GROUP BY Bulk_id_mapping.BulkID;

    Is it possible to make the query so that when the query is run, the user can input the name of the table? Instead of pre defining it (in this case it is firstyear1)

    Also, is there a way of making the fields that are input to be in 'standard" number format and have two decimal places? The fields that are sum sometimes have really long decimal places like 10, and I want it so that there are only two.



  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You can fix the number of decimal places using the Round function:
    Round([Field1]/[Field2],2) AS x
    For the name of the table, you can create the query with a PARAMETERS instruction:
    PARAMETERS  NewTable Text;
    SELECT Table1.Field1, Table1.Field2, Round([Field1]/[Field2],2) AS x 
    INTO NewTable
    FROM Table1
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts