Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To forms: Set Me.recordset=rrdset; and to reports?

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i need to set the recordset of a report from a form in a more easy way than building a condition string or a filter in VBA with which use Docmd.ApplyFliter filtername, whereCondition.

For having the same groups of filtered records when i close a 'non editable records' form and open the same form with some different features like editing, i have used

Set rrdset = Forms!frmGeneral.RecordsetClone
DoCmd.OpenForm "frmGeneral_editing"
Set Forms!frmGeneral_editing.recordSet = rrdset

Is there a similar and so simplified way of opening a report with only the records of the recordset in the form from which the report is opened?

Thanks for looking.
 
If you want to apply the current Filter from the form to the report, you can generally open the report with the Filter in the Where Condition.
Code:
If Len(Me.Filter & "") > 0 And Me.FilterOn = True Then
  strWhere = Me.Filter
End If
DoCmd.OpenReport "rptMyReport", acPreview, , strWhere

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks for the reply, dhookom.

What i want is not opening in preview mode but exporting it to an snp file.

The command

DoCmd.OutputTo acOutputReport, "infGeneral", acFormatSNP, "", False

doesn't give the possibility of filtering, i think.
 
You could possible base your report on a saved query and use code to modify the SQL property of the query.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks, dhookom, for reply.

Finally your idea have helped, i have done it adding the records of the form to a table in which have based the report.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top