UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML/RTF code for calling an object for a report    
 
   
SewerTrout
post Dec 28 2007, 08:21 PM
Post #1

New Member
Posts: 3



OK, first post - thought i did an adequate search in the forum and found nothing, so here goes:

I'm using a report that uses a memo object, formatted as "Rich Text". The memo's control is a DFirst value that calls a value from a separate table. The "DFirst" call works OK because the memo field in the report displays the following:

This letter is concerning [qry_name.FirstName] & " " & [qry_name.LastName] & "."

My question is: Using HTML codes or something similar, can i tell Access that I want the values for my FirstName and LastName instead of displaying it as text?

Thanks in advance.
Go to the top of the page
 
+
HiTechCoach
post Dec 28 2007, 08:58 PM
Post #2

UtterAccess VIP
Posts: 18,396
From: Oklahoma City, Oklahoma



Welcome to Utter Access.

QUOTE
.. can i tell Access that I want the values for my FirstName and LastName instead of displaying it as text?

Not sure what you mean. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/shrug.gif)

If you do not display your FirstName and LastName as text, do you want ot as numbers?

Can you explain in more detail exactly what you are trying to do?

If possible, would give an example of what you are trying to do.
Go to the top of the page
 
+
SewerTrout
post Dec 28 2007, 09:40 PM
Post #3

New Member
Posts: 3



Will do. Thanks for the reply.

I have a group of reports that I would like to consolidate into one template-like report. All the reports prior to this project worked fine. I thought it might be easier if i use one main report and use a table containing the text of the letter as a memo. Of course, the letter has fields in it like a last name, first name, etc. So, when the report worked, i had this as a control source for the report text box:

="This letter is about " & [name_query.First_Name] & " " & [name_query.Last_Name] & "."

... and the results when printed were "This is a letter about John Smith."

I took this control source text and pasted it into a memo field in a new table. I wanted the report text box to now grab the contents of this new table and have it printed the same as before. So, I changed the control source for the text box on the report to say:

=DFirst("[LetterBody]","[tbl_report_data]","[LetterName]='TestLetter'")

... and it works, but I get
="This letter is about " & [name_query.First_Name] & " " & [name_query.Last_Name] & "."

printed on my report.

I hope that makes things clearer. I've been racking my brain to try to explain it better. Thanks again.
Go to the top of the page
 
+
freakazeud
post Dec 29 2007, 10:10 AM
Post #4

UtterAccess VIP
Posts: 31,413
From: NC, USA



Hi,
why do you need these values in a new table field? You can concatenate all this on the fly on the report itself or in an underlying query. BTW...HTML tags don't have anything to do with the values they are wrapped around. They are just used for formatting purposes.
HTH
Good luck
Go to the top of the page
 
+
HiTechCoach
post Dec 29 2007, 01:56 PM
Post #5

UtterAccess VIP
Posts: 18,396
From: Oklahoma City, Oklahoma



I think what you may be trying to do is:

1) write data in to a temp/work table. Each time the criteria selecting the records may vary.

2) use a generic/master report bound to the data from the temp/work table. This way a single report can be used to print without having to change the selection criteria using simple blund controls.

Is this correct?

It appears that you may be using an unboud report since you are using DFrist():

=DFirst("[LetterBody]","[tbl_report_data]","[LetterName]='TestLetter'")


Your report should be bound the that table tbl_report_data. Is it?

I think the issue is how you are writunbg the data into the table tbl_report_data. What code are you suing?
Go to the top of the page
 
+
SewerTrout
post Dec 31 2007, 11:09 PM
Post #6

New Member
Posts: 3



Thanks for the replies. The thought behind this was to give my users the ability to design their own reports. I thought that since the letters are pretty much the same, they could edit a field entry easier than manage a report design view. Plus, I didn't want to give end users the power to change all aspects of the report. I may have a workaround, but i haven't tried it yet. End users would have a text box with buttons that would insert the field references. Then a button to set the value from the text box and preview a sample. If they like it, they could click "OK" to save the new letter as a new report.
Go to the top of the page
 
+
HiTechCoach
post Jan 2 2008, 12:04 PM
Post #7

UtterAccess VIP
Posts: 18,396
From: Oklahoma City, Oklahoma



Are you just wanting to allow the user to modify/edit the body text of the "letter" report?

I currently do this in several of my databases. I have a single report set up as a standard letter with the header and footer fixed. The body text is stored in a table tha the users can add and edit the4 body text for letters.

I basically have crated my own mail merge within Access.

The user can type something like this in the letter body text:

QUOTE
This letter is about <<First_Name>> <<Last_Name>>


Then in code, I replace the field holders ( <<First_Name>> <<Last_Name>> ) with the actual data from the report's record source with something like:

Replace(strBodyText,"<<First_Name>>",[name_query.First_Name])


You will need a replace statement for each field.

I have even used an RTF control so that the users can format the text.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 09:12 AM