Pass a Report Value to a Form?

  • Thread starter Pascoe via AccessMonster.com
  • Start date
P

Pascoe via AccessMonster.com

Hi guys,

I want to run a report in the background, take a final value from the report,
and pass it back into my form, to be displayed.

I know I can easily do this from one form to another form, but as I already
have the report, I was being lazy, and figured I could just take the value
from the report using a macro.... but it doesn't seem to work.

Is there a way of doing this? Or am I being stupid (as well as lazy)?

Thanks!
Russell.
 
A

Al Campagna

Pascoe,
Well, it's a bit unusual for a report to be passing data back
to a form's dataset... which probably would be the source for the report's
recordset... but...
While the for is still open... use the OnFormat event of the report
section
that contains the control value to be passed.
Example:
Form = frmMainForm
Form text control name = ReportValue
Report section = Report Footer
Report text control name = PassValue

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Forms!frmMainForm!ReportValue = Me.PassValue
End Sub

Unable to test, but... that should do it.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
P

Pascoe via AccessMonster.com

Al,

Thanks for your response.

Let me give that a go. I might just take the non-lazy approach and rewrite
the report in a form if i can't nake your route work.

Thanks.
Russell.

Al said:
Pascoe,
Well, it's a bit unusual for a report to be passing data back
to a form's dataset... which probably would be the source for the report's
recordset... but...
While the for is still open... use the OnFormat event of the report
section
that contains the control value to be passed.
Example:
Form = frmMainForm
Form text control name = ReportValue
Report section = Report Footer
Report text control name = PassValue

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Forms!frmMainForm!ReportValue = Me.PassValue
End Sub

Unable to test, but... that should do it.
[quoted text clipped - 11 lines]
Thanks!
Russell.
 
A

Al Campagna

Pascoe,
Please post back if you're successful. We like to know if out
suggestions
are working.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Pascoe via AccessMonster.com said:
Al,

Thanks for your response.

Let me give that a go. I might just take the non-lazy approach and rewrite
the report in a form if i can't nake your route work.

Thanks.
Russell.

Al said:
Pascoe,
Well, it's a bit unusual for a report to be passing data back
to a form's dataset... which probably would be the source for the report's
recordset... but...
While the for is still open... use the OnFormat event of the report
section
that contains the control value to be passed.
Example:
Form = frmMainForm
Form text control name = ReportValue
Report section = Report Footer
Report text control name = PassValue

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Forms!frmMainForm!ReportValue = Me.PassValue
End Sub

Unable to test, but... that should do it.
[quoted text clipped - 11 lines]
Thanks!
Russell.
 

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