I have been cracking my skull all weekend trying to find a solution to this, and I have no idea how to search as I'm not sure what to search for (I have performed a search, but it didn't show what I was looking for, hence, the post).

I have the following query in access 2002:

SELECT BDC_Piece_Defaut.Type_Defaut, Count(BDC_Piece_Defaut.Type_Defaut) AS Instances
FROM BDC_Piece_Defaut INNER JOIN BDC_Compresseur ON BDC_Piece_Defaut.ID_Intervention = BDC_Compresseur.ID_Intervention
WHERE (((BDC_Piece_Defaut.Type_Piece)=[Reports]![RptPieceDefaut]![rsubPiecePeriode]![Pieces]) AND ((BDC_Compresseur.Compresseur)=[Reports]![RptPieceDefaut]![Compresseur]))
GROUP BY BDC_Piece_Defaut.Type_Defaut
ORDER BY Count(BDC_Piece_Defaut.Type_Defaut) DESC;

Now if I replace the parts of the query referencing a report or subreport, I get information. The report has two subsections, The main detailing machine name and # of times it has been repaired, the first subsection details each part and the # of times it has been fixed, and the second subsection details the type of faults each part was taken in for. The main report is controlled via vba code; the user specifies whether to search one or all machines, and for which dates. The first sub report is related to the main report; it shows all machine parts (which belong to said machine). I have no issues with these two.

The third section, is the second sub report, which is a subreport within the first subreport, which details the fault type (and # of times it occurred) by machine part. In order to list the fault type correctly, the sub report obtains two variables: the first being the machine part name (Compresseur) contained in the main report (RptPieceDefaut), and the part name (Pieces, at least that is what I named the field in the subreport) contained in the subreport (rsubPiecePeriode). Whenever I try to open the report, a dialog window keeps asking me to input the value for "Pieces"...

I have tried several things, checking if the code was wrong, to no avail. Any ideas as to why this isn't working? I have to include this report as it is part of my end of studies internship, needless to say, I'm rather stressed.

Any help is appreciated!

Thanks in advance,