?
Solved

Append Text to a Memo Field with or without Existing Data

Posted on 2006-11-12
3
Medium Priority
?
1,092 Views
Last Modified: 2008-01-09
I have a Memo field on a form. The memo field may or may not have data typed in it.

When I reschedule a job (using a form), I would like to have the memo field populated with some data

for example - if the memo field had nothing in it, I want it to read

11/12/2006 - rescheduled from 11/12/06 to 11/15/06 -  by Joe

I will use something like the code below to build the string to insert.....

me.memo = Now() & " - rescheduled from " & [previousdate] & " to "& [newdate] & " - by "& [username]

I am not too worried about the building string


but if the memo field already had data in it, I want the data that is there to remain, then add text below it - like this...


Keys are in mailbox. (existing data)
space
11/12/2006 - rescheduled from 11/12/06to 11/15/06


I am not sure which way I want to do it - so 2 examples are below.....


either like this - no space after existing text(new line right below existing data)

Keys are in mailbox.
11/12/2006 - rescheduled from 11/12/06to 11/15/06

... or maybe like this - a space below existing data

Keys are in mailbox.
 
11/12/2006 - rescheduled from 11/12/06to 11/15/06


I know I need to use something like   vbcrlf  for the space, but how do I add the data after whatever may already be entered in the memo field?


Thanks -AB











0
Comment
Question by:abinboston
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 1000 total points
ID: 17928323
Try:

if len(me.memo) > 0 then
   me.memo = me.memo & cbCRLF &  cbCRLF & Now() & " - rescheduled from " & [previousdate] & " to "& [newdate] & " - by "& [username]
else
   me.memo = Now() & " - rescheduled from " & [previousdate] & " to "& [newdate] & " - by "& [username]
endif

Getting the idea ?

Nic;o)
0
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 1000 total points
ID: 17928487
I agree with nico's approach however I would do it slightly differently, I would also check if It was null - additionally there is a spelling mistake - I'm sure nico meant vbCrLf rather than cbCRLF

if isnull(me.memo) = false and len(me.memo) > 0 then
   me.memo = me.memo & vbCRLF &  vbCRLF & Now() & " - rescheduled from " & [previousdate] & " to "& [newdate] & " - by "& [username]
else
   me.memo = Now() & " - rescheduled from " & [previousdate] & " to "& [newdate] & " - by "& [username]
endif
0
 
LVL 54

Expert Comment

by:nico5038
ID: 17928514
Correct Raynard7, the cb was a typo (mondaymorning fingers, sorry...) and the Null shouldn't interfere, but when you want to check this is the way I generally do it:

if len(Nz(me.memo)) > 0 then
   me.memo = me.memo & vbCRLF  ....etc...

Nic;o)
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question