printing report

Trevor Howard

Registered User.
Local time
Today, 00:13
Joined
Aug 29, 2002
Messages
64
Hello everyone

I have made a report “Service PPM”.

I have a service form (Service table) with subforms (“Contracts”, “Service Visits”, “Peripheral” and “Peripheral extras” tables).

My print button on the service form has the code below on the on click event. My problem is when the print button is activated, all the records are printed. All I want is the one selected in my form. I just cant work this out, spent days on it! I have attached a screen shot of my relationship.

DoCmd.OpenReport "Service PPM", , , "[ServiceID] = " & Me![ServiceID]


I have tried building the report using a query but same results. Something I am not sure of is, is the Customer table the sauce of the problem as it is before my service table??? (I need to have the customer name and address on the report)

Thanks for any thoughts!
Trevor
 

Attachments

  • mius.jpg
    mius.jpg
    93.2 KB · Views: 172
I am not sure if I completely understand you but I have created a report from a form where all of the fields on the report are unbound boxes which related to the form fields rather than the table or query

eg. =[Form]![formname]![field]

so that when I print the form the only results I have are those on the open form.
The form has to be open when the report runs.
 
Call me “Old School” but I still run my filtered reports off a Macro.
With the criteria of the OpenReport as

[ServiceID]=[Forms]![Service Form]![ServiceID]

And then run the macro off the button.
Unsure if this code works in VBA, but some one will know.

Hope this is some help.
:)
 
Thank you both,

Cablegirl,, all boxes are bound, but thanks!

Lister,, I have never tried macros, but will give it a go. the odd thing is what ever I do with my on click event, the result is all reports print, or I get 'enter peramitor ID. The strange thing is I have other forms/subforms which print to reports fine.
:confused:

But thanks for your help!

Trevor
 
If this report is always used to view information for the current record, change the underlying query in the report to include criteria that links the primary field of the table in the report to the primary field of the table in your form. (Which ever record you are currently on when the report is run will then display ONLY information regarding that record.)

Trust this is plain enough.
 
Phil,
Thanks for straightening me out! I notice mark curtis posted a reply and db to ElaJaunie, basically what you suggested.

Thanks to all for your help
 

Users who are viewing this thread

Back
Top Bottom