Pass Returned Query Value to Report Text Box

  • Thread starter Thread starter NeonSky via AccessMonster.com
  • Start date Start date
N

NeonSky via AccessMonster.com

Good Afternoon, as simple as my question may sound I am having a bit of
difficulty passing the results from multiple queries to multiple texts boxes
on the same report. I most certainly would like to learn how to achieve this
functionality through proper coding! And of course I would love to hear
whatever you may think is best! Thank you for your time and consideration!
 
A report is generally based on ONE query. Sure, you can make a report that
includes many sub-reports, each sub-report being based on a single query.

For a report (or sub-report) based on a single query, in the report editor,
drag each field from the query in the appropriate report section to make the
"test boxes" of the report bound to the field of the query you just
dragged..


Hoping it may help,
Vanderghast, Access MVP
 
Hello Michel,

Thank you for your thoughtful response. Curious if there might be anyway
through code to define my datasources, then call those datasources to say a
textbox?

The way I am "imagining" it (and this may or may not be possible) is to
create a Event Procdure on the "On Open" property of the Report. Within this
event procedure I could dim my specific query outputs as say a string (i.e.
Dim strSQL as String... strSQL = qryA.Year). Then simply call those strings
as my data source for textboxes (?). Is this, or something like this possible?
Again many thanks for your time and thoughts!

Michel said:
A report is generally based on ONE query. Sure, you can make a report that
includes many sub-reports, each sub-report being based on a single query.

For a report (or sub-report) based on a single query, in the report editor,
drag each field from the query in the appropriate report section to make the
"test boxes" of the report bound to the field of the query you just
dragged..

Hoping it may help,
Vanderghast, Access MVP
Good Afternoon, as simple as my question may sound I am having a bit of
difficulty passing the results from multiple queries to multiple texts
[quoted text clipped - 3 lines]
functionality through proper coding! And of course I would love to hear
whatever you may think is best! Thank you for your time and consideration!
 
You can, with newer versions of Access, in the Open event.

======================================
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM table1"
Me.Qty.ControlSource = "Qty"
...
End Sub
======================================

Note that IntelliSense won't suggest the ControlSource property, but it
exists. IntelliSense fails to report a lot of properties that are available
to you, in a report (for some obscure reason).



Hoping it may help,
Vanderghast, Access MVP



NeonSky via AccessMonster.com said:
Hello Michel,

Thank you for your thoughtful response. Curious if there might be anyway
through code to define my datasources, then call those datasources to say
a
textbox?

The way I am "imagining" it (and this may or may not be possible) is to
create a Event Procdure on the "On Open" property of the Report. Within
this
event procedure I could dim my specific query outputs as say a string
(i.e.
Dim strSQL as String... strSQL = qryA.Year). Then simply call those
strings
as my data source for textboxes (?). Is this, or something like this
possible?
Again many thanks for your time and thoughts!

Michel said:
A report is generally based on ONE query. Sure, you can make a report that
includes many sub-reports, each sub-report being based on a single query.

For a report (or sub-report) based on a single query, in the report
editor,
drag each field from the query in the appropriate report section to make
the
"test boxes" of the report bound to the field of the query you just
dragged..

Hoping it may help,
Vanderghast, Access MVP
Good Afternoon, as simple as my question may sound I am having a bit of
difficulty passing the results from multiple queries to multiple texts
[quoted text clipped - 3 lines]
functionality through proper coding! And of course I would love to hear
whatever you may think is best! Thank you for your time and
consideration!
 
Hello Michel,

This works great, thank you for the additional and very helpful input!

Happy Holidays!

Michel said:
You can, with newer versions of Access, in the Open event.

======================================
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM table1"
Me.Qty.ControlSource = "Qty"
...
End Sub
======================================

Note that IntelliSense won't suggest the ControlSource property, but it
exists. IntelliSense fails to report a lot of properties that are available
to you, in a report (for some obscure reason).

Hoping it may help,
Vanderghast, Access MVP
Hello Michel,
[quoted text clipped - 33 lines]
 
Back
Top