Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing Rich Text from Access 2010

Posted on 2013-10-31
4
Medium Priority
?
399 Views
Last Modified: 2014-07-31
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
Comment
Question by:ref-IT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 750 total points
ID: 39614940
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
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 750 total points
ID: 39615933
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
 
LVL 2

Author Comment

by:ref-IT
ID: 39623909
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
 
LVL 2

Author Closing Comment

by:ref-IT
ID: 40231298
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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question