From: Song on
I have 2 separate forms. Button on each form opens a report. One
button on one form says "OPEN" and one button on the other form says
"CLOSE"

I do not want to create one report for each button on separate forms.
I just want to use one report to serve both buttons on different forms

On my report, I have lblHeading. If OPEN button is clicked from one
form, I want to change lblHeading to something. If CLOSE button is
clicked from another from, I want to change lblHeading as well.

Thanks for helping.
From: Douglas J. Steele on
What version of Access? Starting in Access 2002 (I believe), the ability to
pass an OpenArgs property was added. Pass anything you want as the OpenArgs
property, and check its value in the report's Open event.

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
Co-author: Access 2010 Solutions, published by Wiley
(no e-mails, please!)

"Song" <song.usa(a)gmail.com> wrote in message
news:874368fa-8cf5-4b4f-afe6-e32de351efd2(a)t34g2000prd.googlegroups.com...
>I have 2 separate forms. Button on each form opens a report. One
> button on one form says "OPEN" and one button on the other form says
> "CLOSE"
>
> I do not want to create one report for each button on separate forms.
> I just want to use one report to serve both buttons on different forms
>
> On my report, I have lblHeading. If OPEN button is clicked from one
> form, I want to change lblHeading to something. If CLOSE button is
> clicked from another from, I want to change lblHeading as well.
>
> Thanks for helping.


From: Song on
Hi, Steele:

I'm using Access 2007. I see OnOpen event of report but I don't know
how to use OpenArgs. I'd be appreciated if you can guide me on this.

Thanks.

Song

On May 27, 11:46 am, "Douglas J. Steele"
<NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote:
> What version of Access? Starting in Access 2002 (I believe), the ability to
> pass an OpenArgs property was added. Pass anything you want as the OpenArgs
> property, and check its value in the report's Open event.
>
> --
> Doug Steele, Microsoft Access MVPhttp://www.AccessMVP.com/DJSteele
> Co-author: Access 2010 Solutions, published by Wiley
> (no e-mails, please!)
>
> "Song" <song....(a)gmail.com> wrote in message
>
> news:874368fa-8cf5-4b4f-afe6-e32de351efd2(a)t34g2000prd.googlegroups.com...
>
>
>
Hi, Steele:

> >I have 2 separate forms. Button on each form opens a report. One
> > button on one form says "OPEN" and one button on the other form says
> > "CLOSE"
>
> > I do not want to create one report for each button on separate forms.
> > I just want to use one report to serve both buttons on different forms
>
> > On my report, I have lblHeading. If OPEN button is clicked from one
> > form, I want to change lblHeading to something. If CLOSE button is
> > clicked from another from, I want to change lblHeading as well.
>
> > Thanks for helping.- Hide quoted text -
>
> - Show quoted text -

From: Douglas J. Steele on
Open the report along the lines of:

DoCmd.OpenReport "NameOfReport", OpenArgs:=Me.Name

Then, in the Open event of the report, check the value passed:

Private Sub Report_Open(Cancel As Integer)

Select Case Nz(Me.OpenArgs, vbNullString)
Case "NameOfForm1"
' do what you want if it was called from Form1
Case "NameOfForm2"
' do what you want if it was called from Form2
Case Else
' do you want to do anything if it was called from somewhere else?
End Select

End Sub

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
Co-author: Access 2010 Solutions, published by Wiley
(no e-mails, please!)

"Song" <song.usa(a)gmail.com> wrote in message
news:e31a81ea-dcdd-4c03-9e84-4afe0e9ff245(a)y18g2000prn.googlegroups.com...
Hi, Steele:

I'm using Access 2007. I see OnOpen event of report but I don't know
how to use OpenArgs. I'd be appreciated if you can guide me on this.

Thanks.

Song

On May 27, 11:46 am, "Douglas J. Steele"
<NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote:
> What version of Access? Starting in Access 2002 (I believe), the ability
> to
> pass an OpenArgs property was added. Pass anything you want as the
> OpenArgs
> property, and check its value in the report's Open event.
>
> --
> Doug Steele, Microsoft Access MVPhttp://www.AccessMVP.com/DJSteele
> Co-author: Access 2010 Solutions, published by Wiley
> (no e-mails, please!)
>
> "Song" <song....(a)gmail.com> wrote in message
>
> news:874368fa-8cf5-4b4f-afe6-e32de351efd2(a)t34g2000prd.googlegroups.com...
>
>
>
Hi, Steele:

> >I have 2 separate forms. Button on each form opens a report. One
> > button on one form says "OPEN" and one button on the other form says
> > "CLOSE"
>
> > I do not want to create one report for each button on separate forms.
> > I just want to use one report to serve both buttons on different forms
>
> > On my report, I have lblHeading. If OPEN button is clicked from one
> > form, I want to change lblHeading to something. If CLOSE button is
> > clicked from another from, I want to change lblHeading as well.
>
> > Thanks for helping.- Hide quoted text -
>
> - Show quoted text -


From: Song on
On May 27, 12:52 pm, "Douglas J. Steele"
<NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote:
> Open the report along the lines of:
>
> DoCmd.OpenReport "NameOfReport", OpenArgs:=Me.Name
>
> Then, in the Open event of the report, check the value passed:
>
> Private Sub Report_Open(Cancel As Integer)
>
>   Select Case Nz(Me.OpenArgs, vbNullString)
>     Case "NameOfForm1"
>       ' do what you want if it was called from Form1
>     Case "NameOfForm2"
>       ' do what you want if it was called from Form2
>     Case Else
>       ' do you want to do anything if it was called from somewhere else?
>   End Select
>
> End Sub
>
> --
> Doug Steele, Microsoft Access MVPhttp://www.AccessMVP.com/DJSteele
> Co-author: Access 2010 Solutions, published by Wiley
> (no e-mails, please!)
>
> "Song" <song....(a)gmail.com> wrote in message
>
> news:e31a81ea-dcdd-4c03-9e84-4afe0e9ff245(a)y18g2000prn.googlegroups.com...
> Hi, Steele:
>
> I'm using Access 2007. I see OnOpen event of report but I don't know
> how to use OpenArgs. I'd be appreciated if you can guide me on this.
>
> Thanks.
>
> Song
>
> On May 27, 11:46 am, "Douglas J. Steele"
>
>
>
> <NOSPAM_djsteele(a)NOSPAM_gmail.com> wrote:
> > What version of Access? Starting in Access 2002 (I believe), the ability
> > to
> > pass an OpenArgs property was added. Pass anything you want as the
> > OpenArgs
> > property, and check its value in the report's Open event.
>
> > --
> > Doug Steele, Microsoft Access MVPhttp://www.AccessMVP.com/DJSteele
> > Co-author: Access 2010 Solutions, published by Wiley
> > (no e-mails, please!)
>
> > "Song" <song....(a)gmail.com> wrote in message
>
> >news:874368fa-8cf5-4b4f-afe6-e32de351efd2(a)t34g2000prd.googlegroups.com....
>
> Hi, Steele:
>
>
>
> > >I have 2 separate forms. Button on each form opens a report. One
> > > button on one form says "OPEN" and one button on the other form says
> > > "CLOSE"
>
> > > I do not want to create one report for each button on separate forms.
> > > I just want to use one report to serve both buttons on different forms
>
> > > On my report, I have lblHeading. If OPEN button is clicked from one
> > > form, I want to change lblHeading to something. If CLOSE button is
> > > clicked from another from, I want to change lblHeading as well.
>
> > > Thanks for helping.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Got it. If I have 2 items to pass, say heading and subheading, is any
efficient way to do it?