Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 30th, 2006, 07:52 PM
Authorized User
 
Join Date: Feb 2006
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding a blank line to a memo field

I have a list box that is linked to a field that is in Memo format. I want to append comments to the list box as they come in, the newest being on top. Here is the code and I put psuedo code where I would like to add a blank line between the new and old comments.

txtComments.Value = cmbRep.Value & " " & Date & " " & Time & " " & txtNewComment.Value _
& " (Blank Line) " & txtComments.Value

The end result would be something like this.

'
Kelly B 10/30/2006 1:33:00 PM Confirmed address info was sent correctly but now we have two provider records that are exactly the same. We should have one provider record with one or more address records.

TW 10/25/2006 11:30:23 AM Will resend with corrected info, should be two different addresses.

Kelly B 10/20/2006 3:33:00 PM Provider info received with two addresses but they are the same.
'

Is there a way to do this?

Thanks,
Scott
__________________
ScottP
 
Old October 31st, 2006, 08:47 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Yes. I think you want "vbCrLf"

That is the vb reserved name for "Carriage Return, Line Feed" (remember typewriters?!)

So it looks like you are taking the current value, appending your new data, and then pushing the concatenated value back in, which is the way to go. So like this:

txtComments.Value = cmbRep.Value & " " & Date & " " & Time & " " & txtNewComment.Value _
& vbCrLf & vbCrLf & txtComments.Value

Did that work?


mmcdonal
 
Old October 31st, 2006, 08:52 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Actually, now that I look at this, I am a big fan of putting your strings etc into variables, and then concatenating the variables. Sometimes Access and VBA have a problem with taking values in functions. So maybelike this:

sOldString = txtComments.Value
sNewString = cmbRep.Value & " " & Date & " " & Time & " " & txtNewComment.Value

Me.txtComments.Value = sNewString & vbCrLf & vbCrLf & sOldString

I might not have gotten that in the right order, but you get the idea.

HTH

mmcdonal
 
Old October 31st, 2006, 01:15 PM
Authorized User
 
Join Date: Feb 2006
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I used what you put in your second email to separate the comments, works great.

Thanks again,

Scott





Similar Threads
Thread Thread Starter Forum Replies Last Post
Memo Field Brendan Bartley Access 11 December 13th, 2007 04:28 PM
Memo field not displaying meichmann SQL Server ASP 3 August 31st, 2006 11:36 AM
MEMO FIELD! With VB6 rolandatem Pro VB Databases 2 January 28th, 2005 10:49 PM
Pagefault from memo field dave_pollak Access VBA 0 November 24th, 2004 10:25 AM
Adding a date to a memo field mikericc Access VBA 2 November 25th, 2003 10:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.