Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Sending Form Data to a report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bretona10 - 29 Mar 2008 00:20 GMT
Hi, I have a form/subform setup as data entry, the subform is partially
populated based on drop down combo on the main form. I want to send the data
from this form/subform to a report. Like a snapshot, with only the records
that are actually on the form. The subform has a counter field as its Key.
Any simple ways to do this?

Thanks, Bret
John W. Vinson - 29 Mar 2008 02:07 GMT
>Hi, I have a form/subform setup as data entry, the subform is partially
>populated based on drop down combo on the main form. I want to send the data
[quoted text clipped - 3 lines]
>
>Thanks, Bret

Sure. Open the Report from the click event of a button on the form; and use
the WhereCondition parameter of the OpenForm method to pass the ID of the
desired record.

DoCmd.OpenReport "YourReportName", WhereCondition := "[Keyfield] = " & Me!Key

using the actual fieldname of the key field in place of Keyfield and the name
of a control on the form containing that value in place of Key.
Signature


            John W. Vinson [MVP]

Bretona10 - 31 Mar 2008 17:24 GMT
Hi John, would this code send all the records in the current subform to the
report?

> >Hi, I have a form/subform setup as data entry, the subform is partially
> >populated based on drop down combo on the main form. I want to send the data
[quoted text clipped - 12 lines]
> using the actual fieldname of the key field in place of Keyfield and the name
> of a control on the form containing that value in place of Key.
John W. Vinson - 31 Mar 2008 18:15 GMT
>Hi John, would this code send all the records in the current subform to the
>report?

No. You're making a very common mistaken assumption here!

The subform DOESN'T contain ANY records.
The report doesn't get any records from the subform.

The subform *is a window*, a tool to display data from a Table.
The report is also a tool that displayes data from a Table.

What you're passing to the report is a query criterion to tell the report
*which* records it should pull from the table. That query criterion is, in
this case, the same criterion that the form uses to specify which records
should be displayed on the subform - so that is the net effect (you see on the
report the same records you see on the subform), but it's important to
understand HOW that happens.
Signature


            John W. Vinson [MVP]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.