Print Preview from Subform

S

Secret Squirrel

On my main form I have a tab control. On one of the tabs I have a subform. On
that subform I have a command button that opens a print preview of a report
that is tied to that particular record on the subform via a query. When I try
to run the report from the subform I'm getting "Enter Parameter Value" from
the query filter I'm using.

SELECT tblBCCorrectiveAction.*, tblBCCorrectiveAction.CA
FROM tblBCCorrectiveAction
WHERE (((tblBCCorrectiveAction.CA)=[Forms]![sfrmBCCorrectiveAction]![CA]));

The above info is correct and the spelling of the form is correct.
Below is the code on the on click event of my command button.

Dim stDocName As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
stDocName = "rptBCCorrectiveAction"
DoCmd.OpenReport stDocName, acPreview, "qryBCCAFilterRMA"
DoCmd.RunCommand acCmdFitToWindow
DoCmd.Maximize

Why am I getting an enter parameter value box when everything seems to be
spelled correctly? Also, when I test this subform by opening it directly
instead of within the tab control on my main form it runs the report fine
without any "enter parameter value" box. So I'm guessing it has to do with
being on a tab control on another form?
 
D

Damon Heron

What happens when you change the select statement Where to:

WHERE (((tblBCCorrectiveAction.CA)=[Forms]![YourMainform
Name]![sfrmBCCorrectiveAction].Form![CA]));

Damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top