Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / December 2003

Tip: Looking for answers? Try searching our database.

Getting a parameter from a form into a Report RecordSource

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Url Onz - 22 Dec 2003 16:41 GMT
I have a stored procedure that I want to use for the
record source of a form. I can put the record source in
the properties box as "Exec ip_rpt 12345" where "12345" is
the parameter I am passing. Now what I need to do is to
get a simple way  to pass the parameter to the proc. It
would be nice to get it from a form. I could then code a
comanc button to open the report.
Andy Williams - 22 Dec 2003 17:13 GMT
Set the recordsource of the report to be the stored procedure.  Then put the
parameter value you would like to pass in the Input Parameters.  Remember,
if you're referencing a control on another form (which you are) you need to
specify that form's name.

Record Source:    ip_rpt
Input Parameters:     Forms!SomeForm!SomeTextbox

You may have noticed that when you run a report based on a parameterized sp,
the report will prompt you for those values before generating the report.
The Input Parameters property does that for you.

Andy-

> I have a stored procedure that I want to use for the
> record source of a form. I can put the record source in
[quoted text clipped - 3 lines]
> would be nice to get it from a form. I could then code a
> comanc button to open the report.
- 22 Dec 2003 17:20 GMT
I never thought of that. I did it by putting the
RecordSource code in the Report module. I'll try your way
too. It looks more elegant.
Here's what I put in the mod:
Private Sub Report_Open(Cancel As Integer)
   Dim cn As String
   cn = Forms!frmOlderCaseJobOffer!txtCN.Text
   Me.RecordSource = "Exec ip_rpt " & cn
End Sub

>-----Original Message-----
>Set the recordsource of the report to be the stored procedure.  Then put the
[quoted text clipped - 20 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.