Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add a return via vba to a field by means of a recordset

Status
Not open for further replies.

Zygor63119

Programmer
Feb 10, 2012
5
US
I have a recordset. I use it to edit a memo field. Each day I loop through it and add a new amount. I need a new line each day.

I have tried rst.fields("DailyAmount")= someamount & vbcrlf and rst.fields("DailyAmount"). I also tried every combination of -
vbcr
vblf
vbnewline
Chr(10)
Chr(13)
vbcrlf

I am entering the amount in a text box. Then, on close, the event edits the field via a recordset(vba). here is a snipit of the code I'm using. strmoved = the current value of the field.

If Nz(Trim(.Fields("NewAmt")), "Null") = "Null" Then
.Fields("NewAmt") = Trim(strMoved)
Else
.Fields("NewAmt") = Trim(strMoved) & vbCrLf & Trim(.Fields("NewAmt"))
End If

When done I hoped to see something like

$12,151
$9,235
$17,662

instead I get - $12,151 $9,235 $17,662

I have tried changing the enterkey behavior and switched between plaintext and richtext.

If someone could shed some light on this I'd appreciate it.


 
hi,

instead I get - $12,151 $9,235 $17,662

Please explain 1) in what application this data is displayed and 2) how it is being displayed.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip. Let me first say thanks for responding. I'm a big fan. :)

This is an Access 2007 database. After I close the form and the onclose event runs, the data is saved to the tables memo field. This is a richtext field. When I open the another form to view the data, also set to richtext, the data is in a line. The field in the table however is in a column as I desire.
This is all done in a single Access database.
 
Just fishing--is there a Property in the form field, for WRAP?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
If I turn off richtext (set the form field to plain text), I get a column. But I need richtext formatting. :(
 
I talked to my customer. They would rather have the column of data than the rich text ability. Issue resolved.

Thank you Skip for taking a look. I appreciate your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top