printing current linked records only

tb5038

Registered User.
Local time
Yesterday, 22:55
Joined
Jan 6, 2014
Messages
32
Hi,

I hope im using the right terminology! I have a main form with a subform. The subform has linked tables from the main form. People are on the main form with the index PersonId and they are linked to incidents by IncidentId.

I want to put in two buttons.

First put a print report button for each subform whereby it will only produce a report for the records I can see on screen . Ie if a person is linked to two incidents I just want the report for those two incidents.

Secondly I would also like a print all button on the subform where it prints reports containing the current IncidentId number.

Hope thats clear, im a novice in access and may not be using the correct terminology! Thanks for reading this and your patience. As you can imagine im really getting to grips with access and vb!
 
Ive been looking at this all morning and so far got

DoCmd.OpenReport "myreportname",,, "[IncidentID]=" & Me![ID]

Unfortunately it printed a three page report to the printer, but I haven't got a printer here!! So Ive tried to amend it to give me a print preview using:

DoCmd.OpenReport "tblItemDetails1", acViewPreview , "[IncidentID]=" & Me![ID]

but it didnt work got an error runtime 438 object doesnt support this property or method. Any pointers anyone could give me would be great!

Thanks
 
You deleted a comma, when you inserted acViewPreview.

Code:
DoCmd.OpenReport "tblItemDetails1", acViewPreview ,[COLOR=Red][B],[/B][/COLOR] "[IncidentID]=" & Me![ID]
 

Users who are viewing this thread

Back
Top Bottom