We've got some form letters that are stored as RTF encoded text fields in
the database. We'd like to include this info into a SQL report. Any one
know if this is do-able, while still maintaining the RTF formatting in the
output?
I think the answer is no, but I wanted to throw it out there anyway.
Regards,
Rob MillerHello Rob,
It is not possible to render into a TextBox . BUT there is a solution...
Create a Custom Assembly into which you create a function which takes in
your RTF encoded field, and returns an image stream and bind that to an
Image Control.
Inside your function, you create a graphics object, and instatiate an RTF
Textbox on it - putting the RTF data in. Then you extract an image of the
drawn grpahics object and output that.
I realise that it is a bit cludgy but it works.
Peter Blackburn
Author: Hitchhiker's Guide to SQL Server Reporting Services
http://www.sqlreportingservices.net
"Rob Miller" <robert.miller@.acoa-apeca.gc.ca> wrote in message
news:uu9XXm0wEHA.3824@.TK2MSFTNGP15.phx.gbl...
> We've got some form letters that are stored as RTF encoded text fields in
> the database. We'd like to include this info into a SQL report. Any one
> know if this is do-able, while still maintaining the RTF formatting in the
> output?
> I think the answer is no, but I wanted to throw it out there anyway.
> Regards,
> Rob Miller
>|||Is there any way to include data fields in this RTF and use your method (or
any other method to automatically create formatted letters)?
Thanks.
Victor
"Peter Blackburn (www.sqlreportingservice" wrote:
> Hello Rob,
> It is not possible to render into a TextBox . BUT there is a solution...
> Create a Custom Assembly into which you create a function which takes in
> your RTF encoded field, and returns an image stream and bind that to an
> Image Control.
> Inside your function, you create a graphics object, and instatiate an RTF
> Textbox on it - putting the RTF data in. Then you extract an image of the
> drawn grpahics object and output that.
> I realise that it is a bit cludgy but it works.
>
> Peter Blackburn
> Author: Hitchhiker's Guide to SQL Server Reporting Services
> http://www.sqlreportingservices.net
>
>
> "Rob Miller" <robert.miller@.acoa-apeca.gc.ca> wrote in message
> news:uu9XXm0wEHA.3824@.TK2MSFTNGP15.phx.gbl...
> > We've got some form letters that are stored as RTF encoded text fields in
> > the database. We'd like to include this info into a SQL report. Any one
> > know if this is do-able, while still maintaining the RTF formatting in the
> > output?
> >
> > I think the answer is no, but I wanted to throw it out there anyway.
> >
> > Regards,
> > Rob Miller
> >
>
>
Showing posts with label form. Show all posts
Showing posts with label form. Show all posts
Tuesday, February 14, 2012
Can I Query a Form?
I currently have a form setup to read a table display information from the table depending of what primary key is being chosen on the form.
When the primary key is picked, the rest of fields on the form are auto populated.
What I want to do is have a query run to obtain the information off of the form, so that a report can be run off of the query. However, maybe I am going about this the long way? The reason is because when I attempt to run the report directly off of the form, none of the fields are entered, I simply get blanks in the form fields.
Is it possible, and do I need to go with option 1? Or is there an easier way to accomplish this?This might be a little more than you asked for but the concept still works for just one key field instead of many fields to limit the search.
The free downloadable sample database at www.bullschmidt.com/access uses the query by form concept so that on the invoices dialog one can optionally choose a rep, a customer, and perhaps a date range, click on a button that says "Input," and then have the invoice form open up showing all the invoices that match the criteria.
And here is how the query by form concept can work.
On the invoices dialog there are the following controls:
InvDateMin with DefaultValue of =DateSerial(Year(Date())-1,1,1)
InvDateMax with DefaultValue of =Date()
InvRepNum with DefaultValue of *
InvCustNum with DefaultValue of *
Also on the invoices dialog there is a command button called cmdInput to open the invoices form with the following code behind the OnClick property:
DoCmd.OpenForm "frmInv"
And of course there could be a button to open a report the same way:
DoCmd.OpenReport "rptInv", acViewPreview
The invoices form (frmInv) has RecordSource property of qryInv.
And the qryInv query's criteria for the InvDate field has:
Between [Forms]![frmInvDialog]![InvDateMin] And [Forms]![frmInvDialog]![InvDateMax]
And the qryInv query's criteria for the RepNum field has:
Like [Forms]![frmInvDialog]![InvRepNum]
And the qryInv query's criteria for the CustNum field has:
Like [Forms]![frmInvDialog]![CustNum]
One related point is that you probably wouldn't want to allow blanks (i.e. Nulls) in fields that are going to be used with Like in any criteria for that field. Otherwise the blanks wouldn't be shown. And to counter that you might consider creating the query's SQL statement dynamically so that the criteria on a particular field isn't used unless needed.
When the primary key is picked, the rest of fields on the form are auto populated.
What I want to do is have a query run to obtain the information off of the form, so that a report can be run off of the query. However, maybe I am going about this the long way? The reason is because when I attempt to run the report directly off of the form, none of the fields are entered, I simply get blanks in the form fields.
Is it possible, and do I need to go with option 1? Or is there an easier way to accomplish this?This might be a little more than you asked for but the concept still works for just one key field instead of many fields to limit the search.
The free downloadable sample database at www.bullschmidt.com/access uses the query by form concept so that on the invoices dialog one can optionally choose a rep, a customer, and perhaps a date range, click on a button that says "Input," and then have the invoice form open up showing all the invoices that match the criteria.
And here is how the query by form concept can work.
On the invoices dialog there are the following controls:
InvDateMin with DefaultValue of =DateSerial(Year(Date())-1,1,1)
InvDateMax with DefaultValue of =Date()
InvRepNum with DefaultValue of *
InvCustNum with DefaultValue of *
Also on the invoices dialog there is a command button called cmdInput to open the invoices form with the following code behind the OnClick property:
DoCmd.OpenForm "frmInv"
And of course there could be a button to open a report the same way:
DoCmd.OpenReport "rptInv", acViewPreview
The invoices form (frmInv) has RecordSource property of qryInv.
And the qryInv query's criteria for the InvDate field has:
Between [Forms]![frmInvDialog]![InvDateMin] And [Forms]![frmInvDialog]![InvDateMax]
And the qryInv query's criteria for the RepNum field has:
Like [Forms]![frmInvDialog]![InvRepNum]
And the qryInv query's criteria for the CustNum field has:
Like [Forms]![frmInvDialog]![CustNum]
One related point is that you probably wouldn't want to allow blanks (i.e. Nulls) in fields that are going to be used with Like in any criteria for that field. Otherwise the blanks wouldn't be shown. And to counter that you might consider creating the query's SQL statement dynamically so that the criteria on a particular field isn't used unless needed.
Subscribe to:
Posts (Atom)