Print part only of a report (1 Viewer)

PeteB

Registered User.
Local time
Yesterday, 16:23
Joined
Mar 15, 2016
Messages
78
I have an inventory database within which I have created a grouped report to return records for all items based (grouped) on 'Location'.
I need to print the records returned for a particular location at any one time.
How would I do this?
Help from the experts would be much apprceiated.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:23
Joined
May 7, 2009
Messages
19,230
on the Report Load Event, add an InputBox asking for a particular Location, eg:

Private Sub Report_Load()
Dim strLocation As String
strLocation = Inputbox("Enter [Location] or leave blank to include all", "Location")
If strLocation <> vbNullstring then
Me.Filter="Location Like """ & strLocation & """"
Me.FilterOn=True
End If
End Sub
 

PeteB

Registered User.
Local time
Yesterday, 16:23
Joined
Mar 15, 2016
Messages
78
Hi Arn
Thanks very much for that - what do you mean by 'Input Box'? (you are dealing with an amateur here).
 

June7

AWF VIP
Local time
Yesterday, 15:23
Joined
Mar 9, 2014
Messages
5,470
Options:

1. simplest is to manually set static filter criteria in query used as report RecordSource

2. Use dynamic parameter input popup in query

3. VBA code to dynamically pass filter criteria to report when it opens - arnelgp provides example of one approach

Review http://allenbrowne.com/ser-62.html
 

PeteB

Registered User.
Local time
Yesterday, 16:23
Joined
Mar 15, 2016
Messages
78
Hi Arne
Thanks for that. I will try and absorb the information you posted and I'm certain will be able to go with one of your options.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:23
Joined
Feb 19, 2002
Messages
43,257
The DoCmd.OpenReport method takes a where clause. Use that. There is no reason to write code when property settings will do the job more efficiently.
 

Users who are viewing this thread

Top Bottom