Specify InputParameters for Report in VB Code

  • Thread starter Thread starter Beau Lendman
  • Start date Start date
B

Beau Lendman

This code doesn't work on the OnOpen property of my report:

Me.RecordSource = "spTemp"
Me.InputParameters = "@temp int=" & Forms!Form1!Temp

Basically, the input parameter isn't getting passed to the
stored procedure.

Any ideas on what's wrong would be most appreciated.

Thanks

Beau

(e-mail address removed)
 
Please try something on the lines of

Me.RecordSource = "Exec dbo.spTemp" & Forms!Form1!Temp
 
For some reason, you cannot change the recordsource & inputparameters in a
report at runtime. There are two options. 1) It looks like you have a
fixed stored procedure recordsource. I would put what you have in the
properties in design mode rather than in code. That is the easiest most
affective solution. The other option is to run code that actual puts your
form into design mode and allows you to programmatically change the design
of the report. The thing to note with this method is that you cannot use it
in an .ade, it must be in an .adp.

HTH,
Jim
 
Thanks for your suggestion... but when I try this, I get a
message that the recordsource "Exec..." does not exist.
It seems to evaluate Exec as part of the name of the
recordset...?

Any further guidance would be most appreciated.
 
Oops Sorry..

Forgot to mention

"Exec dbo.spTemp " & Forms....

The space after spTemp in the command is important
because the parameter has to be concantenated after a
space.
 
Back
Top