Adding text to memofield

JEPEDEWE

Registered User.
Local time
Today, 21:40
Joined
Nov 11, 2010
Messages
34
Hello,
I have a record with a memofield.
On this record I created a pushbutton with following code:
Me.TxtOpmerkingen = vbCrLf & TxtOpmerkingen
Me.TxtOpmerkingen = Date & vbCrLf & TxtOpmerkingen
TXOpmerkingen is a memo-field
With this code I add the current date on top of the memofield..
Everyting works just great but
I would like to get the date underlined an written in bold
What is teh syntax to do so?
Thanks
JP
 
You probably need something like this:

Code:
<div><strong><u>Your date here</u></strong></div>
 
Me.TxtOpmerkingen = <div><strong><u> date </u></strong></div> & vbCrLf & TxtOpmerkingen

gives a compilation error

thanks for your kind help
 
Me.TxtOpmerkingen = <div><strong><u> date </u></strong></div> & vbCrLf & TxtOpmerkingen

gives a compilation error

thanks for your kind help

I expect '& vbCrLf &' is the issue - you're trying to use HTML & VBA together
Try this

Code:
Me.TxtOpmerkingen = <div><strong><u> date </u></strong></div><div> Me.TxtOpmerkingen</div>

If not what was the error and where exactly does it occur
 
You must format the field, in design view (Text Format) as Rich Text and not Plain Text.
 
Colin,
I miss the | vbCRlF in your code
and I still get the compilation error where "= <" after Me.TxtOpmerkingen is highlighted

saying "expected: expression" (this is what i translate from Dutch to English)
 
Where do I find this Rich Text setting (I have a ducth version of access so... )
Which tab should I choose

Thanks for your reply
 
You may have fixed it by doing what arnel suggests

Anyway, here's an example of what I meant showing both the form with HTML/rich text & the underlying code used

attachment.php


Just to confuse you, I'm using Plain text not Rich Text formatting for this textbox

The setting for Rich/Plain Text is in the textbox property sheet

attachment.php


EDIT:
Just spotted you cross-posted this at http://www.accessforums.net/showthread.php?t=69895
Please read the link provided by Bob Fitz in that thread
 

Attachments

  • Capture.jpg
    Capture.jpg
    101.7 KB · Views: 290
  • Property.PNG
    Property.PNG
    8.3 KB · Views: 230
Last edited:
I changed the format of the memofield
now I get a syntax error in the line:

Me.TxtOpmerkingen = <div><strong><u> date </u></strong></div> & vbCrLf & TxtOpmerkingen

Sorry I don't understand the situation fully
(and that I cross-posted my question)
 
See my code in post #4
If still stuck, suggest you post the relevant parts of your db
 
Here is the file..
Hope you can help.
Thanks a lot

JP
Belgium, Flanders
 

Attachments

As I don't speak Dutch (sorry), can you tell me what to click
I can see the code that doesn't compile
 
Oops sorry

Go to "hoofdmenu"
Pick a name
"Fiche" opens
Click "File" an this should add the (bold, underlined) current date on top of the TxtOpmerkingen memofield

Greetz
 
Your database is so locked down that it will take a while to unlock it & test for a solution

It may be something obvious but at the moment, I can't even enable the B/I/U text formatting buttons in the ribbon though I can add formatting to the date in that box by using the right click context menu

It may assist someone solve it if you could unlock the db so the database form(s) are easily editable
 
Can't you unlock it by clicking on te shift button while you click "enter" with the cursor on the files name?
Strange
 
I've used the Shift key, allowed full menus, made nav pane visible & removed the dialog setting on the form so I could go into design view
However. its still partly locked somewhere.

In my opinion, you need to provide your db in a format ready for us to use as doing that wasted several minutes

sorry - no time to do more now but if time, I'll look later.
Hopefully someone else will look at it in the meantime
 
Sorry but language is a problem for me too but you need to delimit the html Markup sorta like this
Code:
Me.TxtOpmerkingen = "<div><strong><u>" & Date & "</u></strong></div><div>" & Me.TxtOpmerkingen & "</div>"
 
Check tgis out my friend.
 

Attachments

Oops I had omitted quotes and ampersands.
Brain obviously not working well today.
Close but no cigar as they say.
 
Mushing multiple attributes into a single field violates first normal form and makes the data harder to use. A far better solution is to add a separate field to hold the date. Then when you display the date in its own control, you can set its format to whatever you want.
 

Users who are viewing this thread

Back
Top Bottom