If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Two Questions regarding make table query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-12, 10:07
grooner10 grooner10 is offline
Registered User
 
Join Date: Sep 2011
Posts: 45
Two Questions regarding make table query

Hi,

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.

thanks,

Kevin.
Reply With Quote
  #2 (permalink)  
Old 01-20-12, 12:20
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
You can fix the number of decimal places using the Round function:
Code:
Round([Field1]/[Field2],2) AS x
For the name of the table, you can create the query with a PARAMETERS instruction:
Code:
PARAMETERS  NewTable Text;
SELECT Table1.Field1, Table1.Field2, Round([Field1]/[Field2],2) AS x 
INTO NewTable
FROM Table1
__________________
Have a nice day!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On