Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Sending parameters


Message #1 by "Ajay Jain" <ajain@i...> on Wed, 24 Jul 2002 17:11:41 -0400
Hi,

How do I send paramaters to a report. I need to pass a couple of dates to
the report from a form.

Thanks
Ajay

Message #2 by "Gregory Serrano" <SerranoG@m...> on Thu, 25 Jul 2002 12:56:11
Ajay,

<< How do I send paramaters to a report. I need to pass a couple of dates 
to the report from a form. >>

If the report always opens from the same form, then on the report's "On 
Open" event enter this code to an unbound text box on the report:

   Me.txtDateR = Forms.frmMyForm.Form.txtDateF

where txtDateR and txtDateF are textboxes that hold a date in the report 
and the form respectively.

Change txtDateR to whatever your date field is called on the report and 
change txtDateF to whatever your date field is called on the form.  Also 
change frmMyForm to whatever your form name is.

Greg
Message #3 by "Kenny Alligood" <kennyalligood@h...> on Thu, 25 Jul 2002 10:16:50 -0400
If these parameters are coming from controls on a form then you can just include them in the Query or
SQL RecordSource of the report. I use SQL because I think it works faster than having to fire a Query to work. If you don't know how
to write SQL open up a new query in design and create a Query that produces the data you are looking for. Once that is accomplished
change the Query view to SQL and copy and paste.

Hope this helps.

Kenny

----- Original Message -----
From: Ajay Jain
Sent: Wednesday, July 24, 2002 5:49 PM
To: Access
Subject: [access] Sending parameters

Hi,

How do I send paramaters to a report. I need to pass a couple of dates to
the report from a form.

Thanks
Ajay


to unsubscribe send a blank email to Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

Message #4 by "Dawn Nelson Everett" <Deverett@d...> on Thu, 25 Jul 2002 10:31:26 -0400
You can create a query and base the report on that query.  In the query where the date field is you
simply reference the form and the field name where the date is entered.
EX: Forms!FormName!FieldName
You place this in the criteria for the date field in the query
and put a button to open the report on the form.

Dawn Nelson Everett
Data Management / ISPE
Operations Analyst 2
445-1529

>>> kennyalligood@h... 07/25/02 10:16AM >>>
If these parameters are coming from controls on a form then you can just include them in the Query or SQL RecordSource of the
report. I use SQL because I think it works faster than having to fire a Query to work. If you don't know how to write SQL open up a
new query in design and create a Query that produces the data you are looking for. Once that is accomplished change the Query view
to SQL and copy and paste.

Hope this helps.

Kenny

----- Original Message -----
From: Ajay Jain
Sent: Wednesday, July 24, 2002 5:49 PM
To: Access
Subject: [access] Sending parameters

Hi,

How do I send paramaters to a report. I need to pass a couple of dates to
the report from a form.

Thanks
Ajay


to unsubscribe send a blank email to Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com



Message #5 by "John Ruff" <papparuff@c...> on Thu, 25 Jul 2002 07:32:32 -0700
Here's one way:

    Dim stDocName As String

    stDocName = "rptBirthdays"
    DoCmd.OpenReport stDocName, acViewNormal, , "Bdate>=#" & cboFromDate
& "# AND Bdate<=#" & cboToDate & "#"


John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities

www.noclassroom.com
Live software training
Right over the Internet

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3





-----Original Message-----
From: Ajay Jain [mailto:ajain@i...] 
Sent: Wednesday, July 24, 2002 2:12 PM
To: Access
Subject: [access] Sending parameters


Hi,

How do I send paramaters to a report. I need to pass a couple of dates
to the report from a form.

Thanks
Ajay



Message #6 by "Ajay Jain" <ajain@i...> on Thu, 25 Jul 2002 11:58:03 -0400
John,

The code you suggested is good for where condition of the report. What if I
need to pass a value of variable to the report and show it on some control.
I want to pass the values like we do in functions and procedures.

Ajay Jain
Infotech Consulting, Inc.
3461 Market Street Suite 303
Camp Hill PA 17011
Phone:  (xxx) xxx-xxxx  x 236
Fax  :  (xxx) xxx-xxxx
Web  : www.icibsl.com


-----Original Message-----
From: John Ruff [mailto:papparuff@c...]
Sent: Thursday, July 25, 2002 10:33 AM
To: Access
Subject: [access] RE: Sending parameters


Here's one way:

    Dim stDocName As String

    stDocName = "rptBirthdays"
    DoCmd.OpenReport stDocName, acViewNormal, , "Bdate>=#" & cboFromDate
& "# AND Bdate<=#" & cboToDate & "#"


John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities

www.noclassroom.com
Live software training
Right over the Internet

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3





-----Original Message-----
From: Ajay Jain [mailto:ajain@i...]
Sent: Wednesday, July 24, 2002 2:12 PM
To: Access
Subject: [access] Sending parameters


Hi,

How do I send paramaters to a report. I need to pass a couple of dates
to the report from a form.

Thanks
Ajay





Message #7 by braxis@b... on Thu, 25 Jul 2002 17:42:09 +0100 (BST)
Ajay

Here're a couple of methods:

This is the simplest method. Use code similar to this in the reports Open event.

    Me![lblFromForm]=Forms![frmCalledFrom]![FormcontrolName]

A method with a slightly object oriented flavour, which allows manipulation of the passed parameter and lets the parameter be called
in the same way from many reports.

Add code like this to the form.

Public Property Get ReportParam() as Long

    ReportParam=Me![FormcontrolName] * 3

End Property

Then add this code to reports Open event.

    Me![lblFromForm]=Forms![frmCalledFrom].ReportParam

Brian
>  from:    Ajay Jain <ajain@i...>
>  date:    Thu, 25 Jul 2002 16:58:03
>  to:      access@p...
>  subject: Re: [access] RE: Sending parameters
> 
> John,
> 
> The code you suggested is good for where condition of the report. What if I
> need to pass a value of variable to the report and show it on some control.
> I want to pass the values like we do in functions and procedures.
> 
> Ajay Jain
> Infotech Consulting, Inc.
> 3461 Market Street Suite 303
> Camp Hill PA 17011
> Phone:  (xxx) xxx-xxxx  x 236
> Fax  :  (xxx) xxx-xxxx
> Web  : www.icibsl.com
> 
> 
> -----Original Message-----
> From: John Ruff [mailto:papparuff@c...]
> Sent: Thursday, July 25, 2002 10:33 AM
> To: Access
> Subject: [access] RE: Sending parameters
> 
> 
> Here's one way:
> 
>     Dim stDocName As String
> 
>     stDocName = "rptBirthdays"
>     DoCmd.OpenReport stDocName, acViewNormal, , "Bdate>=#" & cboFromDate
> & "# AND Bdate<=#" & cboToDate & "#"
> 
> 
> John V. Ruff - The Eternal Optimist :-)
> Always Looking For Contract Opportunities
> 
> www.noclassroom.com
> Live software training
> Right over the Internet
> 
> Home:  xxx.xxx.xxxx
> Cell:  xxx.xxx.xxxx
> 9306 Farwest Dr SW
> Lakewood, WA 98498
> 
> "Commit to the Lord whatever you do,
>     and your plans will succeed."  Proverbs 16:3
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Ajay Jain [mailto:ajain@i...]
> Sent: Wednesday, July 24, 2002 2:12 PM
> To: Access
> Subject: [access] Sending parameters
> 
> 
> Hi,
> 
> How do I send paramaters to a report. I need to pass a couple of dates
> to the report from a form.
> 
> Thanks
> Ajay
> 
> 
> 
> 
> 
> 


  Return to Index