Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 30th, 2006, 07:52 PM
Authorized User
 
Join Date: Feb 2006
Location: Sacramento, CA, USA.
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
Reply With Quote
  #2 (permalink)  
Old October 31st, 2006, 08:47 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #3 (permalink)  
Old October 31st, 2006, 08:52 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #4 (permalink)  
Old October 31st, 2006, 01:15 PM
Authorized User
 
Join Date: Feb 2006
Location: Sacramento, CA, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.