Adding text to memofield (1 Viewer)

JEPEDEWE

Registered User.
Local time
Today, 14:29
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
 

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
You probably need something like this:

Code:
<div><strong><u>Your date here</u></strong></div>
 

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
Me.TxtOpmerkingen = <div><strong><u> date </u></strong></div> & vbCrLf & TxtOpmerkingen

gives a compilation error

thanks for your kind help
 

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:29
Joined
May 7, 2009
Messages
19,246
You must format the field, in design view (Text Format) as Rich Text and not Plain Text.
 

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
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)
 

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
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
 

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
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



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



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: 268
  • Property.PNG
    Property.PNG
    8.3 KB · Views: 208
Last edited:

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
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)
 

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
See my code in post #4
If still stuck, suggest you post the relevant parts of your db
 

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
Here is the file..
Hope you can help.
Thanks a lot

JP
Belgium, Flanders
 

Attachments

  • File.zip
    116.4 KB · Views: 76

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
As I don't speak Dutch (sorry), can you tell me what to click
I can see the code that doesn't compile
 

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
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
 

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
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
 

JEPEDEWE

Registered User.
Local time
Today, 14:29
Joined
Nov 11, 2010
Messages
34
Can't you unlock it by clicking on te shift button while you click "enter" with the cursor on the files name?
Strange
 

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
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
 

moke123

AWF VIP
Local time
Today, 09:29
Joined
Jan 11, 2013
Messages
3,940
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>"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:29
Joined
May 7, 2009
Messages
19,246
Check tgis out my friend.
 

Attachments

  • File.zip
    116.2 KB · Views: 79

isladogs

MVP / VIP
Local time
Today, 14:29
Joined
Jan 14, 2017
Messages
18,261
Oops I had omitted quotes and ampersands.
Brain obviously not working well today.
Close but no cigar as they say.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:29
Joined
Feb 19, 2002
Messages
43,478
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

Top Bottom