setting controls in report from form

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hi,

I was wondering what the syntax is for setting the controlsource of a report
based on the values from a form.

I have a form which has recordset, but i want it do it for a report as well,
but a report doensn't have a recordset property.

So basically i want to use values from the form's controls to display in the
report. All textboxes in the report has the same names as in the form.

Can it be done something like for each control in form do...... (i don't
know the syntax)
 
Jason,

Reports have a RecordSource property which can be changed
programatically. On the other hand, if what you are trying to achieve is
to filter the report based on selections in the form, then the
WhereCondition argument of DoCmd.OpenReport is your friend! All you
would need is something along the limes of:

strWhere = "[Field1] = '" & Me.Contol1 & "'"
DoCmdOpenReport "MyReport", acViewPeview, , strWhere

behind the command button (on the same form) that opens the report.

HTH,
Nikos
 
Back
Top