InputParameters is set, but Access still prompts for parameter values...

G

Gus

Hi everyone, I have an Access 2002 ADP file with a report that calls
on a SQL Server 2000 stored procedure. The report is opened from a
form named frmReportList. The report's Report_Open event should be
setting the parameters for the procedure call, but when I call on the
report, Access still prompts me for values to the stored procedure. Am
I setting the input parameters correctly? Is Report_Open the right
place to do this? How can I stop Access from prompting me to enter
stored procedure parameters and set those parameter values instead
from VBA? Thanks everyone!

Private Sub Report_Open(Cancel As Integer)
Me.InputParameters = "@StartDate
datetime=Forms!frmReportList!txtStartDate, @EndDate
datetime=Forms!frmReportList!txtEndDate"
End Sub

Gus
 
E

Eva Etxebeste

Hello Gus

Try using this:

Private Sub Report_Open(Cancel As Integer)
Me.InputParameters = _
"@StartDate datetime=" & Forms!frmReportList!txtStartDate & " , " & _
" @EndDate datetime=" & Forms!frmReportList!txtEndDate
End Sub

Or, if you want, write your original string

@StartDate datetime=Forms!frmReportList!txtStartDate, @EndDate
datetime=Forms!frmReportList!txtEndDate

in design time. When you open the report, it will evaluate both
Forms!frmReportList!txtStartDate and Forms!frmReportList!txtEndDate, and
will use their values in the Stored Procedure

Regards
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the location of the parameters doesn't change and since the
InputParameters refer to a form's controls, why not put that string in
the report's InputParameters property instead of doing it using VBA?
Also, the form has to be open & have data in the controls to work. Is
the form "frmReportList" open?


MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQC2zP4echKqOuFEgEQK7xwCg9xi7bFkQYUFzMBICEOUEoibCmb0AoJ92
M82qhFboOEnBjnDxj/GDfPxN
=Y8NB
-----END PGP SIGNATURE-----
 

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