Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append query won't append field calculated from other hidden fields

Status
Not open for further replies.

CTOROCK

Programmer
May 14, 2002
289
US
I have an append query that does not append the value of a field that is caluclated from two other fields in the query. the query works well as a SELECT query but when I then switch it to an append query, choose the destinated fields, but I leave some fields blank, not appending to a destination field and I get an error.
This is what I have done:

INSERT INTO tblCommissionPayout ( [Date], RepIDNo, RepName, TotalMargin, NonEligGTM, [EligMargin$], TotalPay )
SELECT tblCommissionData.RunDate, tblCommissionData.SalesRepNo, tblCommissionData.SalesRepName, Sum(tblCommissionData.[Marg$]) AS [TotalMarg$], Sum(IIf([Bonus]="No",[Marg$],0)) AS NonEligibleGTM, [TotalMarg$]-[NonEligibleGTM] AS [GTMBal$], [BonusGTM1]+[BonusGTM2] AS TotalBonus
FROM tblCommissionData
GROUP BY tblCommissionData.RunDate;

But the BonusGTM1 and BonusGTM2 are calculated fields in my query. But they don't show up since I don't have them assigned going anywhere. Is there any way to do this? Any help is apreciated


The greatest risk, is not taking one.
 
calculated fields in my query
Which query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,

This Append query was originally a select query, which has the field [TotalBonus] as a calculation from two other fields I made up with calculations. [TotalBonus] = [Bonus1] + [Bonus2]. But I don't need the Bonus1 and Bonus2 appended. I use [Bonus1] and [Bonus2] beacause the formula is too long and won't fit in one field slot, so divide the criteria and combine the results later. When I swicth to an append query I don't assign a field for [Bonus1] and [Bonus2] to go to and hence, [TotalBonus] doesn't calculate. Is there any way around this? Thanks for any help

The greatest risk, is not taking one.
 
What is the SQL code of your working select query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top