Query parameter popping up

sjr1917

Registered User.
Local time
Today, 08:54
Joined
Dec 11, 2012
Messages
47
Two queries acting as RecordSource for a report:
1) gives donations for all donors within a pair of dates
2) is further restricted with second WHERE clause to only show 1 donor

The report (when using the second query) pops up a modal box asking for the value of ContribDt. Why??

Here's the second query's SQL:
SELECT Donors.Addressee, Donors.Address, RTrim([City])+", "+[State]+" "+[Zip] AS CityStZip, Contributions.Amount, Contributions.Fund
FROM Donors INNER JOIN Contributions ON Donors.ID = Contributions.DonorID
WHERE (Contributions.ContribDt Between Forms!frmRecordDonations!txtStDt And Forms!frmRecordDonations!txtEndDt) And (Contributions.DonorID=TempVars!donor);

Only difference between this one on and the first query (which doesn't ask for the ContribDt is the last And.... phrase. The parentheses don't exit in the first query either. But I've tried removing them with no change in results.

Oddly, when I just click OK on the modal parameter window, without entering a value... the report print ok anyway.
 
Yes. Double checked that already.
Table: Contributions
Field: ContribDt

As I noted, the 2 queries are identical except for the final Where clause on the second one that limits it to only one donor.

First query doesn't throw the error, second one does.

Also tried the Access square brackets:
[Contributions].[ContribDt]
no joy!
 
From where comes "TempVars!donor", I can't see any table with the name "TempVars"?
 
TempVars!donor has been corrected since my original post. It is actually: TempVars!donor.Value

This globally available variable is set in the calling program from the value of a Combo Box holding all the DonorID's and names.
 
Solved!! I knew it was something simple. Pat had the right idea.
I was focusing so much on the WHERE clause and spelling the table/field code properly that I failed to see that I had accidentally uncheck the "Display this field in the query".
So the field that was needed for a column in the report wasn't in the query's field list.

Light always comes in the morning... I should learn to wait :)
 

Users who are viewing this thread

Back
Top Bottom