Report Record Source

G

gr

Hello, I want to let users select which field should be
included in a report.
I already code a form in order to get strQryPersonal which
is the SQL string (SELECT ..... FROM ... WHERE ... )

What I don't how to do is to set the Record Source
property of a report (saved report) to this
strQryPersonal. Should I use the DAO CreateQueryDef? (I
don't want to store the query) or is it possible to set
the RecordSource property = [Forms]![frmPersonnelInfo]!
[frmCV].[Form]![txtQryPersonal]

Also how should I manage the fact that sometimes some
fields will be chosen by the user and sometimes not (Can
Grow, Can Shrink, Visible, not visible) in order to
provide a nice layout?

thx.
gr
 
M

Marshall Barton

gr said:
Hello, I want to let users select which field should be
included in a report.
I already code a form in order to get strQryPersonal which
is the SQL string (SELECT ..... FROM ... WHERE ... )

What I don't how to do is to set the Record Source
property of a report (saved report) to this
strQryPersonal. Should I use the DAO CreateQueryDef? (I
don't want to store the query) or is it possible to set
the RecordSource property = [Forms]![frmPersonnelInfo]!
[frmCV].[Form]![txtQryPersonal]

Also how should I manage the fact that sometimes some
fields will be chosen by the user and sometimes not (Can
Grow, Can Shrink, Visible, not visible) in order to
provide a nice layout?


You can set the report's RecordSource in the report's Open
event procedure:

Me.RecordSource=Forms!frmPersonnelInfo!frmCV.Form!txtQryPersonal

You can also set most control, section and group level
properties in the Open event.
 

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