Modules & VBA :: Change Color Of Substring In Rich Text Field
Aug 14, 2013
I'm using Access 2010. I'm passing a string into the OpenArgs of my report - works fine. In the report there are 3 rich text fields which may contain the text I passed in, and if so I want to change the color of that text to red so it stands out.
The value passed to the report changes so I'll need to use VBA in the detail's format section to check each of the 3 rich text fields.
how I can set a color on table column formatted as rich text and memo. For instance this table has 4 different columns of remarks, one from each engineering operating center. Remarks_1, Remarks_2, Remarks_3 and Remarks_4. Each one of the 4 operating centers enters the remarks in one of these fields. On the Dashboard report, what I do is I get all these 4 fields and merge in 1 because the report is already narrow due to several other columns as well. So there is a report combining all data : =Remarks_1& " -"&Remarks_2&" - "&Remarks_3&" - "&Remarks_4 under Remarks.
The point is that the Dashboard has colorcode, Orange for Remarks_1, Red for Remarks_2, Blue for Remarks_3 and Green for Remarks_4. All these fields are memo on rich text format. On the form I have set the color of each field, however the color doesn't get set on the table as well, but only on the form fields. How can I set a defined color to each field on the table? And also when I get all data in one column, I would see all different colors.
We need to move rich text from an Access memo field to a Word text box. So far the best Ive been able to come up with is in the code below. In this code pprs!What is a record set field of a table memo field that is bound to a text box enabled for rich text. The rich text seems to be stored as html as so I can get word to convert it by enclosing it in html tags.
Dim What As Word.Shape Set What = doc.Shapes.AddTextbox(msoTextOrientationHorizontal , doc.PageSetup.LeftMargin, 225, 534, 0) Dim sPath As String sPath = "G:Temp.html" Open sPath For Output As 1 Print #1, "<HTML>" & pprs!What & " </HTML>" Close #1 What.TextFrame.TextRange.InsertFile (sPath)
I have a Form Display Data in my Access Database, which is working really well. However, users was asking if there is a way we can make Font Color Could/would change if The text in A field or Any field in my display form contained the word "SAD or MAD". Is there code for such thing in display form?..
I'm trying to output some logging to a form with a Rich text textbox
This is what the form is displaying: 14:16:32: check OK: 500<10000andS235='s460'> 14:16:32: check OK: 500<10000andS235='s355'> 14:16:32: check failed:too short 500<1000231231 > 14:16:32: Ready ...
There is some coloring in the text but I'm not display that here (copy/paste of the textbox)
This is the HTML behind it (? txtbox in imm.window): 14:16:32: <font color=black>check OK: 500<10000andS235='s460'</font><br />14:16:32: <font color=black>check OK: 500<10000andS235='s355'</font><br />14:16:32: <font color=red><strong>check failed:too short 500<1000231231 </strong></font><br />14:16:32: <font color=green><strong>Ready ... </strong></font><br />
The problem is in the red > that are added to each line. I have no clue where they are coming from, in fact: they are NOT in the HTML.When I display this piece of HTML in IE I don't get the red > behind each line.I have tried to use <p> of <div> instead of <br/> but that makes no difference
I have a report which I would like to change the text of a field blue if a certain condition is met. What I want to happen on this report is if a specific field has an "Active" - then it will be in Blue text, otherwise it is in black text.
I have gone into the report ->in the Details section -> put a procedure in the On Format event. The code I have been trying is:
----- If Analysis_Status = Active Then Me.Analysis_Status.ForeColor = vbBlue Else Me.Analysis_Status.ForeColor = vbBlack End If End Sub ----
On a form how can i get the text to change to red if the number is Greater than 500 and blue if the number is less than 500, the text box is populated via a query
I have a report card program that I use in my classroom. The program calculates letter grades for various sub categories.
For example, under the Primary Category Math, the computer will calculate a letter grade based on assignment scores and place the grade into a combo box for the sub category "Able to use a graphing calculator."
If I override the grade the program calculated for a student, I would like the text in the combo box to change to red for that student only. Then I can go back and quickly see which grades I have manually changed.
I just cannot seem to figure out the logic to use VBA that would check to see if a user has changed individual combo boxes.
I have two forms sourced from one table. if the address of a client has changed then there is a Command button that opens a form to enter the previous address.
What I want is for the text on the command button to change to red if there is a previous address filled in. I have seen it done but cannot copy the code. What I have is on the OnCurrent event of the (main form)
Dim InColor As Integer InColor=255
Me.[Command126].Forecolor=(And what I want to say here is "If the field previousaddress is not null then ...)*255
Any ideas??? (I wanted to have the database completed before the New Year (less than 12 hours to go!!!)
I am attempting to create an expression that will change the font to red if it is an overdue date. It will be on a form with the records showing.
My datebase is for entering, changing, and searching for information dealing with orientation dates, contacts, and associations. My data sheet holds the company name, employee name, date of orientation, due date (orientations are completed annually), contact employee, and status. I would like the date, when opening the form, to show red if it is past due. how to create an expresion to return the status as "Current" or "Overdue", as I am still unsure which method I want to use.
I have been sending plain text emails for a while, but now I have a project where the formatting of the text needs to be specific and I need to send as rich text.
I can use the rich text from a table, excel, or word, but I am at a loss on how to get the data to Lotus Notes.
I am generating a report that needs to have a hyperlink in part of one of the fields. Prior to saving the field to the database I do a bit of VBA coding on it and add some HTML. The result is this in the field:
"There are two ways to book with your preferred rate: <br>
2. Call us directly or at 1-800-Hampton and use your Corporate ID 12345."
It works beautifully if you paste it into a web page but in the Access report, Access applies the Bold but just ignores the hyperlink.
This is Access 2013 with MS SQL Server 2008 backend. Everything I have read suggests that this should work and is supported. Is there some trick I'm missing?
I have a process that is getting data from sharepoint page, containing 2 list. Both list contain one field I am having issues in my export, a 'Multiple Lines of Text' type field which is Rich Text in sharepoint. I have an access DB with a linked table to those 2 list. Access show the one field I am having problems with as Memo.
The Linked table pulls/display the rich text data field correctly. My access query pulls/displays the data correctly.
My export procedure does not, the cell it exports to includes the HTML Tags. How can i modify my VBA export procedure to export to excel in plain text, i dont need the same format, just want to drop the html tags.
Code: Public Sub StatusReportExport() On Error Resume Next ' Test to see if the file currently exist, if so, delete file, so new file can be written. Kill ("L:Connect SiteStatus Report " & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & ".xls") If Dir("L:Connect SiteStatus Report " & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & ".xls") <> "" Then MsgBox "Status Report.xls File already in use!" & vbNewLine & "Please Close File, then rerun Report."
I have a VBA code to import mail from Lotus Notes into Access. The database user is able to read his email inside Access, similar to any email program.
Unfortunately, when I use the GetItemValue (lotusscript) method to read the body of the email message, Notes will render the Rich Text information as Plain Text, and I end up with no formatting information (bold letters, underline, text color, etc.)
How to import messages from Notes to Access and keep the text formatting? I am storing the data in a Rich Text Memo field in a table. I have found code to write HTML (MIME) messages, but not to import them into Access.
I'm about to connect my DB to word. So I made a form where the user has to choose what entry to export. The data is inserted in a word file in different bookmarks. But there is one special task to insert the rich text so in this case the html formatted text is displayed like this:
I have a similar problem, I'm fairly new to ACCESS and am learning it is vastly different than EXCEL that we use (we are upgrading to ACCESS to track our "in" and "out". I have set up a ACCESS database to track our barge loading and pumping, on the delay we enter reason for the delay but if no delay occurs it is left blank. How can I get the field to change colors if information is entered and left alone if none is entered. Quote: Originally Posted by shamrog12 Make sure to dim recItem1Value and backg in the appropriate area
Try this: Code:<%recItem1Value = lcase(Recordset1.Fields.Item("RecItem1").Value)backg = ""Select Case recItem1Value Case "x" backg = " style=""background-color:red;"" " Case Else backg = ""End Select%><!-- whatever code here... //--><td<%=backg%> nowrap><input name="txtField1" type="text" onChange="RecUpdate value="<%=(Recordset1.Fields.Item("RecItem1").Value)%>" size="4"></td>
I have an Access 2010 database with a memo field formatted for Rich Text.
I created a simple form. It accepts and shows paragraphs, i.e. I press Return and a new paragraph appears (with a blank line in between paragraphs).
I then created a report based on the same fields. In the memo field it shows the text entered in the form, but not the paragraph breaks. It just shows one big block of text without any paragraph breaks. I have looked for a field property in the report design and layout views that might affect how the text is displayed in the report but I cannot find one.
It is not much use if you can input paragraph breaks in a form but not see them in a report.
I have an unbound listbox on a form which displays a list of staff, both past and present, based on an SQL query.
I want to be able to differentiate between current and past staff using different colors, i.e. Black text for current employees and red for employees who have left, based on a field (True/False) in the original staff table.
I have some code to check a combo box if a date field is filled in, then the combo box can't be empty.I can make the error message appear, but the combo box does not want to change color and it does not recognize any other than value..This is the code that I have, and it does not work like I wish it could.(I took the database over from some one else and need to make improvements on it. the field names where not created by me).
Code: Private Sub cmbCurrentStatus_AfterUpdate() '<<<<<<<<<<<<<<<< Working on >>>>>>>>>>>>> If IsNull(Me.[STEP 1 4 check current status]) And Not IsNull(Me.[Checked__date_]) Then MsgBox "Checked (date) can't be empty if Current Status is filled in!", , "Incomplete Form!" Me.[STEP 1 4 check current status].Value = RGB(255, 0, 0) Else Me.[STEP 1 4 check current status].BackColor = RGB(255, 255, 255) End If End Sub
how to change background color of MSAccess Reports using VBA? How can I do border coloring. What are the vba codes for all color options like light green, light blue etc. How to change the font type to bold etc using vbaI did some changes to text box coloring in Detail Section on format click event.