Solved

Append Text to a Memo Field with or without Existing Data

Posted on 2006-11-12
3
1,091 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 250 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 250 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

726 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