Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

Printing Rich Text from Access 2010

Hello Experts,

In an application that I designed for a client using MS Access, I have a Form that has a Sub Form with multiple records linked to the parent form. This Sub Form is a Continuous Form that has a field with Rich Text.

The client wants to be able to select a number of rows and when he clicks a 'Print' button, the Rich Text in the selected rows should be printed.

Any ideas how this can be achieved ?!!?

Thanks you all in advance.

ref-IT
0
ref-IT
Asked:
ref-IT
  • 2
2 Solutions
 
Helen FeddemaCommented:
You would have to make a report with the appropriate fields from the form's record source, then filter the report's data source by the appropriate ID field from the selected records.  This would be much easier to do with a multi-select listbox, which would allow you to use the ItemsSelected collection.  Actually, this might be required, because you can't select multiple rows in a CF form.  If you have to work with the CF subform, you could perhaps write the ID from each selected row in turn to another table, and use that for filtering the report.  Or you could create a concatenated filter string, saving it to a public variable or a custom database property, for filtering the report.

Some of my Access Archon articles might be helpful here:

Fancy Filters:  http://www.helenfeddema.com/Files/accarch129.zip

Filtering by Multiple Selections:  http://www.helenfeddema.com/Files/accarch197.zip

Rich Text in Access 2007:  http://www.helenfeddema.com/Files/accarch157.zip
0
 
Jeffrey CoachmanCommented:
Please only use reports to print.
Then this is easy to control.

<The client wants to be able to select a number of rows >
Select multiple rows how?
Do you need non-contiguous selections?
..In any even you can print reports from multiple listbox selections with something like this attached file:
Access-BasicMultiSelectListBoxRe.accdb
0
 
ref-ITAuthor Commented:
Hey Experts,

Firstly, I apologise for the delay in response. I got held up with some other projects that I was working on.

Secondly, I truly appreciate your time and assistance in helping me resolve this issue.

I have gone through both your suggestions and they are very helpful, however, let me describe the situation more clearly:

I have put Check Boxes next to the Rich Text Box, to allow the user to select whatever rows that need to be selected (remember this is a Continuous Form). When the user clicks the 'Print' Button, using VBA Code, the application can either:

Method 1:

- Select all the records from the underlying table that the user has checked and have the same ID as the parent record (the Continuous Form is also a Sub Form)
- Using a record-set, output all the data to a word document and send it to a printer

OR

Method 2:

- Simply filter a report based on what the user has checked and has the same ID as the Parent forms ID

Method 1 is longer, but I do not know of any variable in VBA that can hold Rich Text data. Is there any variable in VBA that can hold Rich Text Data? The string variable would only strip the Rich Text of all its formatting and output it as normal text.

Method 2 is a better way of resolving this issue and it is what both of you suggested and I like this way better. However, there is only one problem I'm facing with it.

The text in the Rich Text Box in the report is not always large enough to show all text (as there can be paragraphs upon paragraphs in it). And sometimes, it's too large for the text in it (as there can only be one sentence).

Is there anyway I could increase the height of the Rich Text Box in the report if there was a lot of data in it and decrease the height in the report to fit the amount of text in it ?

Hope it's a bit more clear now.

Thanks,

ref-IT
0
 
ref-ITAuthor Commented:
It's been quite some time before I could award points to this question.

Anyway, thanks to Helen and Boag2000 for all their help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now