Form to Report to Query Input Parameters Annoyance

J

John

I have a form (“frmQryMainâ€) that I use to input query parameters. It
consists of combo (sourced by tables) and text boxes and a “Run Reportâ€
button which activates an event to open the “rptMain†report (via the
stDocName tool – see event code below). The idea is that a user will input
their parameters (Nulls allowed), and run the report (“rptMainâ€).

“rptMain†is generated using the “qryMain†query.

“qryMain†references the “frmQryMain†form for the parameters, and allows
nulls to act as non-limiting factors. (See SQL Below).

The process works great except I am prompted to input parameter values for
each field after executing the report. If I ignore each prompt by simply
entering past it, the report returns data based on the entries in the
“frmQryMainâ€. What is the deal here? Why am I not able to eliminate the
parameter prompts?

Any help getting past this would be appreciated.
Thanks

As a side bar - The “qryMain†does reference multiple tables as indicated in
the SQL – Is this the definition of a “cross tab†query?

I used the fontstuff.com tutorial to build this and want to give them props
for a well documented lesson.

Programming of "Run Report" Command Button on frmQryMain:

Private Sub cmdRunReport_Click()
stDocName = "rptMain"
DoCmd.OpenReport stDocName, acViewPreview
End Sub

SQL of qryMain (after saving it)

SELECT tblAA.AATitle, tblAA.AADescription, tblAA.AANoticeDate, tblAA.AAOrg,
tblAA.AAAuditorAssessor, tblAA.AAStatus, tblFOs.OfficialFONumber,
tblFOs.FODescription, tblFOs.RiskRating, tblFOs.FOStatus,
tblMCA.OfficialMCANumber, tblMCA.RespDir, tblMCA.RespDept, tblMCA.RespDiv,
tblMCA.RespGroup, tblMCA.RespPerson, tblMCA.[Recommended MCA],
tblMCA.Determination, tblMCA.DueDate, tblMCA.MCAStatus, tblCAPR.CAPR,
tblCAPR.CAPRDate
FROM ((tblAA LEFT JOIN tblFOs ON tblAA.SysGenAANumber = tblFOs.AANumber)
LEFT JOIN tblMCA ON tblFOs.SysGenFONumber = tblMCA.FONumber) LEFT JOIN
tblCAPR ON tblMCA.SysGenMCANumber = tblCAPR.MCANumber
WHERE (((tblMCA.RespDiv)=[Forms]![frmQryMain]![tbxRespDiv]) AND
((tblMCA.MCAStatus)=[Forms]![frmQryMain]![cboMCAStatus]) AND
((tblAA.OfficialAANumber)=[Forms]![frmQryMain]![cboAANumber])) OR
(((tblMCA.MCAStatus)=[Forms]![frmQryMain]![cboMCAStatus]) AND
((tblAA.OfficialAANumber)=[Forms]![frmQryMain]![cboAANumber]) AND
((([tblMCA].[RespDiv]) Like [Forms]![frmQryMain]![tbxRespDiv]) Is Null)) OR
(((tblMCA.RespDiv)=[Forms]![frmQryMain]![tbxRespDiv]) AND
((tblAA.OfficialAANumber)=[Forms]![frmQryMain]![cboAANumber]) AND
((([tblMCA].[MCAStatus]) Like [Forms]![frmQryMain]![cboMCAStatus]) Is Null))
OR (((tblAA.OfficialAANumber)=[Forms]![frmQryMain]![cboAANumber]) AND
((([tblMCA].[RespDiv]) Like [Forms]![frmQryMain]![tbxRespDiv]) Is Null) AND
((([tblMCA].[MCAStatus]) Like [Forms]![frmQryMain]![cboMCAStatus]) Is Null))
OR (((tblMCA.RespDiv)=[Forms]![frmQryMain]![tbxRespDiv]) AND
((tblMCA.MCAStatus)=[Forms]![frmQryMain]![cboMCAStatus]) AND
((([tblAA].[OfficialAANumber]) Like [Forms]![frmQryMain]![cboAANumber]) Is
Null)) OR (((tblMCA.MCAStatus)=[Forms]![frmQryMain]![cboMCAStatus]) AND
((([tblMCA].[RespDiv]) Like [Forms]![frmQryMain]![tbxRespDiv]) Is Null) AND
((([tblAA].[OfficialAANumber]) Like [Forms]![frmQryMain]![cboAANumber]) Is
Null)) OR (((tblMCA.RespDiv)=[Forms]![frmQryMain]![tbxRespDiv]) AND
((([tblMCA].[MCAStatus]) Like [Forms]![frmQryMain]![cboMCAStatus]) Is Null)
AND ((([tblAA].[OfficialAANumber]) Like [Forms]![frmQryMain]![cboAANumber])
Is Null)) OR (((([tblMCA].[RespDiv]) Like [Forms]![frmQryMain]![tbxRespDiv])
Is Null) AND ((([tblMCA].[MCAStatus]) Like
[Forms]![frmQryMain]![cboMCAStatus]) Is Null) AND
((([tblAA].[OfficialAANumber]) Like [Forms]![frmQryMain]![cboAANumber]) Is
Null));
 

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