Specify InputParameters for Report in VB Code

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)
 
S

Sapphire

Please try something on the lines of

Me.RecordSource = "Exec dbo.spTemp" & Forms!Form1!Temp
 
J

J. Clay

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
 
G

Guest

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.
 
S

Sapphire

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.
 

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