Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 7th, 2003, 09:48 PM
Registered User
Join Date: Oct 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
     (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

Old October 8th, 2003, 02:16 PM
tjw tjw is offline
Registered User
Join Date: Sep 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts


A suggestion

For your report query try entering in the criteria under JOBID field the following:

[Forms]![Name of your Form]![JobID] or what the field name is that takes JOBID

Hope this helps


Old October 8th, 2003, 02:24 PM
Registered User
Join Date: Oct 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Brilliant, worked perfectly, exactly what was required.

Thanks for your help


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters to crystal reports at runtime tbhakee Crystal Reports 14 September 11th, 2013 05:49 AM
passing parameters to crystal reports Shubhi ASP.NET 2.0 Professional 0 July 4th, 2008 02:18 AM
Passing parameters w/o prompt to Crystal Reports VannAustin BOOK: Professional Crystal Reports for VS.NET 1 August 31st, 2006 08:46 AM
Passing Parameters to crystal reports through codi secrets Crystal Reports 0 April 5th, 2005 01:44 PM
Passing parameters w/o prompt to Crystal reports VannAustin VB How-To 0 March 2nd, 2005 02:16 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.