Passing parameters to reports
Hey ppl,
I have a report which gets its data from a query. I then have an onClick event on the form and what I am trying to do is send the JobID (which is a textbox on the form) to the report so that it doesn't display the prompt box. I can't do it through the WHERE parameter of the Macro to open the report (it doesn't seem to pick it up, maybe because the JobID is in the SQL as an @JobID parameter).
Here's the code to the SQL which may better explain it (@JobID 4th line from bottom). The SQL works fine, just need to automatically pass the JobID into this.
-------------------------------------------------------------
SELECT Customer,Phone_Make,Imei,Date,Job_Ref,Pallet
FROM tbl_Imei AS i, tbl_Pallets AS j, tbl_Jobs AS k, tbl_Phones AS l
WHERE i.PalletID=j.PalletID
AND j.JobID=k.JobID
AND k.PhoneID=l.PhoneID
AND Imei IN
(SELECT a.Imei FROM tbl_Imei AS a, tbl_Pallets AS b
WHERE a.Imei In
(SELECT Imei FROM tbl_Imei GROUP BY Imei HAVING COUNT(*) > 1)
AND b.JobID=@JobID
AND a.PalletID=b.PalletID
GROUP BY a.Imei)
ORDER BY Imei,Date,Pallet;
-------------------------------------------------------------
Hope this is kinda clear to someone.
Many thanks
Kam
|