Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a report from a form 1

Status
Not open for further replies.

k9handler

MIS
Dec 13, 2008
17
US
I've created a form [JobTrans] with a subform [JobTransDetail] to record transactions. The linked field is [Reference]. I'm trying to add a button that runs a report based on the current record on the form including items from subform. I designed a report "JobTrans-Ref" based on a query with a parameter [Reference ?] in the [JobTrans]![Reference] field.

When I run the report I get the standard Access parameter dialog box and the report runs just fine after typing (or copy & paste)in the [Reference ?].

How do I get the [Reference] that is on the current form to pass to the query parameter.

Thanks
 
Have a look here:
faq701-6763

In your query, replace this:
[Reference ?]
with this:
[Forms]![JobTrans]![Reference]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the information. The suggestion is what I had already used in my query. I still get the same "standard MS Access" parameter box instead of my form. It's almost as if Access does not know the form is out there. Any ideas? I'm not even sure what additional information about my database to share. Thanks again.
 
How are ya rhyust . . .

C'mon rhyust ... [blue]we can't help you if we can't see the SQL! ...[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
This is the SQL. The query works when I request the report. But uses the standard parameter query dialog box.

SELECT JobMaster.JobID, JobMaster.JobDesc, JobTrans.TranDate, JobTrans.Reference, JobTrans.TranType, JobTransDetail.ItemID, JobTransDetail.Quantity, JobTransDetail.Cost, [quantity]*[Cost] AS [Value]
FROM (JobMaster INNER JOIN JobTrans ON JobMaster.JobID = JobTrans.JobID) INNER JOIN JobTransDetail ON JobTrans.Reference = JobTransDetail.Reference
WHERE (((JobTrans.Reference)=[Reference ?]));

What I changed it to is:

SELECT JobMaster.JobID, JobMaster.JobDesc, JobTrans.TranDate, JobTrans.Reference, JobTrans.TranType, JobTransDetail.ItemID, JobTransDetail.Quantity, JobTransDetail.Cost, [quantity]*[Cost] AS [Value]
FROM (JobMaster INNER JOIN JobTrans ON JobMaster.JobID = JobTrans.JobID) INNER JOIN JobTransDetail ON JobTrans.Reference = JobTransDetail.Reference
WHERE (((JobTrans.Reference)=[Forms]![FindReferences]![SelectedReference]));

The result is the same. It does not seem to see my form [FindReferences]. It still brings up the standard parameter query dialog.

Thanks for the help
 
This query
Code:
SELECT JobMaster.JobID, JobMaster.JobDesc, JobTrans.TranDate,
 JobTrans.Reference, JobTrans.TranType, JobTransDetail.ItemID,
 JobTransDetail.Quantity, JobTransDetail.Cost, [quantity]*[Cost] AS [Value]
FROM (JobMaster
 INNER JOIN JobTrans ON JobMaster.JobID = JobTrans.JobID)
 INNER JOIN JobTransDetail ON JobTrans.Reference = JobTransDetail.Reference
WHERE (((JobTrans.Reference)=[Forms]![FindReferences]![SelectedReference]));
will not ask for [Reference ?]. If is does, you are not providing all the correct information.

Is the form "FindReferences" open?

Duane
Hook'D on Access
MS Access MVP
 
The form not being open looks like the problem. I opened the form, selected my reference and then ran the report. Worked fine. So, the question is - How do I open the form "FindReferences" before I click on the report?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top