Validate text format of a textbox

ted.martin

Registered User.
Local time
Today, 15:01
Joined
Sep 24, 2004
Messages
743
I need to check after data entry that the text format of a Rich Text box (for html display purposes) is of the correct text format.

I am not concerned about the content only that it is Calibri Size 12 and the correct colour has not been changed by the user.

This code does not do it.

Code:
Private Sub Content1_AfterUpdate()

Content1.SetFocus
Content1.SelStart = 0
Content1.SelLength = Len(Content1.Value & "")

Content1.FontName = "Calibri"
Content1.ForeColor = RGB(0, 32, 96)
Content1.FontSize = 12

End Sub

Thank you
 
Have you tried your code in the Before Update event
 
Yes, unfortunately Before Update does not work either.

I need to Text format to revert to the default settings upon Exiting the text box. It does not work with On Exit too.

Thanks
 
I think it might be better to deny users access to the forms properties. Then they will not be able to change these settings.
 
Not practical, the inteli sense box is need for bold etc.
 
As it is a Rich Text box, a little formatting box pops up. That is my problem; the font name and size could be changed
 
How do you access this Rich Text box and which version of Access are you using
 
It has been around since 2007, I think. You have a Rich Text box, just highlight some text and it pops up. Does the same in Word too. Surely you have seen this?
 
It has been around since 2007, I think. You have a Rich Text box, just highlight some text and it pops up. Does the same in Word too. Surely you have seen this?
I went from 2003 to 2013. I do not appear to have this feature in my Access 2013
 
You will have; it is a standard feature for Rich Text boxes in Access and Word too.

Tyr typing some test in a Word doc and then highlight the text. The intelli-sense formatting box will pop up.
 
You will have; it is a standard feature for Rich Text boxes in Access and Word too.
And of course you are quite right. I seldom use what used to be called "Memo" type data fields. The availability of this new feature had clearly passed my by. Thank you. I shall need to re-read the OP now :)
 
Can I reinstate this as we got side-tracked and I still do not have a solution - thanks.
 

Users who are viewing this thread

Back
Top Bottom