Print a Report Based on Datasheet Selection

  • Thread starter Thread starter ABinBoston
  • Start date Start date
A

ABinBoston

I have a datasheet with, let's say 100 records.

If I select 25 or how can I print a report that will contain only the selectd
records?

AB
 
AB,
Select File/Print, and in the Print dialog box in the Print Range
section, check the Selected Record(s) option.
hth
Al Camp
 
Method 1. Use a Yes/No Field.
You can select only contiguous records in a datasheet. To work around that,
add a yes/no field to your table. You can then check the boxes of the
records you want to print, and then:
DoCmd.OpenReport "MyReport", acViewPreview, , "[IsPicked] = True"
To clear all the boxes again:
dbEngine(0)(0).Execute "UPDATE MyTable SET IsPicked = False WHERE
IsPicked = True;", dbFailOnError

Method 2. Use an unbound multi-select list box to choose the values for the
report.
Details in:
Use a multi-select list box to filter a report
at:
http://members.iinet.net.au/~allenbrowne/ser-50.html

Method 3. Print a contiguous range selected in a datasheet.
Use SelTop and SelHeight to identify which records are selected. Then loop
through those records, concatenating the primary key values into a string
that can be used with the IN operator in the WhereCondition of the
OpenReport action. The example above will illustrate the string you are
trying to build.
 
Back
Top