Print Selected Records in a Subform?

C

cefrancke

Can someone put to rest, if there is a way to print records selected in
a subform ? (Access 2K-2K3)
To be clear: Highlighted records from clicking and dragging with the
mouse the "current record indicator box" to the far left of a subform
in datasheet view. (I hope that was clear :)

I can print the current record: Send the report the current ID
I can print all records: Send the report the subform's filter

But I'm not sure the proper approach to printing a contiguous
"selected" set of records in the subform?

I haven't found anything on using SelTop, SelLeft, etc.
However, I find the selection disappears after clicking the Print
button outside the subform (btw in datasheet view).
Could I capture it on a subform event?


I've read about including a "print" check box in the table structure of
the main table of the query, and clear it afterwards with an update
query.
Is there a way to avoid to do this? For a pre-existing database this
can mean a lot of tables.
What about multi user? The table update would clear marked records
for another user.
Someone (back in 1998) said the ADHB has some info on the "Print"
check box approach, I cant find it.

Any confirmation on the SelTop, etc. approach and/or the use of a
"Print" field would be appreciated.

I just dont want to waste too much time, if there is a commonly used
approach for this seemingly necessary feature.


TIA
 
K

KARL DEWEY

You might try to build the report by opening the form in design view then
click menu EDIT - Select All - copy.
Create report without source. In design view paste. Go back to the form and
copy the record source and paste into the properties of the report.
You might need to do some tweaking of the settings.
 
A

Allen Browne

When you click the button on the form, it receives focus. At that point,
your multiple-selection is lost, because the focus has moved. That means you
can never have multiple records selected when the Click event of a command
button fires.

One way around that is to create a custom toolbar button. You can then read
the SelTop and SelHeight of the form to determine which records are
selected. Looping through the records, you can concetenate a string to use
as the WhereCondition of OpenReport. Typically it would end up looking
something like this:
"[ID] IN (3,4,5,6)"

The other alternative is to add a yes/no field to the table, and check the
boxes on the rows you want to print. That sounds like what you meant by:
the "Print" check box approach
 
K

KARL DEWEY

If your subform is a datasheet you can select by clicking in the left column
and highlighting, copy, paste in Word. The column labels will be in the
pasted info and the text will wrap.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top