Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have never been to any technical site that shows concern just to anybody with problems...I look forward to also share in the future..."

Geography

Where in the world do Tek-Tips members come from?
k9handler (MIS)
24 Apr 12 22:07
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
PHV (MIS)
25 Apr 12 8:16
Have a look here:
FAQ701-6763: Why not use Parameter Prompts

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

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

k9handler (MIS)
27 Apr 12 15:28
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.
dhookom (Programmer)
27 Apr 12 18:15
What is the SQL view of the query?
Is the form open when you run the query/report?

Duane
Hook'D on Access
MS Access MVP

TheAceMan1 (Programmer)
28 Apr 12 7:33
How are ya rhyust . . .

C'mon rhyust ... we can't help you if we can't see the SQL! ...

See Ya! .  .  .  .  .  .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2

k9handler (MIS)
1 May 12 19:53
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
 
dhookom (Programmer)
1 May 12 21:42
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

k9handler (MIS)
1 May 12 21:51
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?
Helpful Member!  dhookom (Programmer)
1 May 12 22:21
I open the form first and have a button on the form to open the report.

Duane
Hook'D on Access
MS Access MVP

k9handler (MIS)
4 May 12 17:35
Got things working - thanks all for the help

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close