
April 21st, 2005, 02:11 PM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 9
Time spent in forums: 2 h 22 m 34 sec
Reputation Power: 0
|
|
|
Well, here's the short answer: You're doing a Report based off of a query, based off of another query, based off of input from a form. I believe that this is your problem. Your report is calling on the recordset of a query. That query gets it's values from a recordset of another query, which in turn gets IT'S recordset from a form. I believe your getting prompted for data because the second query is trying to process data from the first when the first hasn't been run. Following the principles of K.I.S.S., I found that I could get all the data I needed for the report in one query, and the SQL statement for that query is listed below:
SELECT DISTINCT Detail.ScrapCode, Sum(Detail.Weight) AS SumOfWeight, Detail.Comment, Detail.YY, Detail.MM, Master.CYR, Master.CMonth
FROM Master INNER JOIN Detail ON Master.DocNo = Detail.fDocNo
WHERE (((Master.DocCode)=[Forms]![input_check(II)]![txtCode]) AND ((Master.TransCode)=[Forms]![input_check(II)]![txtTrans]) AND ((Master.DocNo) Between [Forms]![input_check(II)]![txtFrm] And [Forms]![input_check(II)]![txtTo]))
GROUP BY Detail.ScrapCode, Detail.Comment, Detail.YY, Detail.MM, Master.CYR, Master.CMonth;
To use this, make a new query in design view, switch to SQL view, paste this statement, and save. Then, build your report off of this query.
On a side note, having the primary key in a table where repeats are allowed is generally a bad idea. You may be able to get by in a relatively small database, but if this particular one gets to be fairly complex, you're really going to start running into problems trying to get the data you need.
|