Send current form to a report

  • Thread starter Thread starter louonline
  • Start date Start date
L

louonline

Hi,
I have a colorful form for entering data.
I would like to create a buttom on the form that will send the CURRENT
record to a report and print it .
I've tried a few things but I get nothing or the wrong record (mostlly
the previous record)
The criteria is based on a number field on the form.
Any help with actual code sample would be greatly appeciated.

Regards,
Lou
 
louonline said:
Hi,
I have a colorful form for entering data.
I would like to create a buttom on the form that will send the CURRENT
record to a report and print it .
I've tried a few things but I get nothing or the wrong record (mostlly
the previous record)
The criteria is based on a number field on the form.
Any help with actual code sample would be greatly appeciated.

Regards,
Lou

Lou, two ways to accomplish this. One is using a query and one is the
report's filter.

Let me give you the query version. What you do is create yourself a
query that you use as the record source for the report. In the query,
use the table that holds the number field you are displaying on your
report. Then, set the criteria equal to
[Forms]![frmYourReportName]![txtYourNumberField]. You can use the build
function in the criteria to help you select the form and the control on
it (very easy if the form is open).

Then, if you run the query with the form open, you should only get a
single record (e.g. the current one).. and thus the same on your report.
 
Thanks Duncan,
I don't reallly need to filter anything as all the fields on the form
are sent to the report to be printed in plain draft text without all
the colorful bits on the form.

Regards,
Lou
 
louonline said:
Thanks Duncan,
I don't reallly need to filter anything as all the fields on the form
are sent to the report to be printed in plain draft text without all
the colorful bits on the form.

Regards,
Lou

I think there might be some confusion here. Are you trying to print the
form directly and are calling it a report? Or are you creating a report
object in Access that you want to print from a command button on the form?

My suggestion of using a query as the recordsource for the report is the
best solution I can think of when trying to understand what you are
explaining.
 
Thank you for your reply Duncan.
INo, I wasn't trying to print thr form as a report.
I had a report created based on the form but i was getting ALL the
records printed instead of just the current one.
I''ve managed to get the required result after a bit of playing around
and hair-pulling.
I'm now working on another 'problem' in trying to group/break-down some
figures on the report.
I will give your suggestion with a query a go and see what I can do.
I may have to call on your assistance again.

Regards,
Lou
 
Back
Top