Cut and Paste Macro

flicky_long

New member
Local time
Today, 07:23
Joined
Jan 22, 2009
Messages
4
Afternoon,

Can anyone help me write a vb module on an access form (called frmRequest) to do the following:

1) Cut the contents of a memo field called 'Most Recent Entry'
2) Paste the data into another memo field (inserting a carriage return/line space) between the previous line of data and the pasted data

i.e. Pasted Data

Old Data

Thanks!!
 
Last edited:
Me.OldMemoField = Trim(Me.OldMemoField) & vbNewline & vbNewLine & Trim(Me.NewMemoField)
 
Thanks for this dcrake, can you briefly explain what exatly this will do, it doens't contain any of the memo field names so I'm not exactly sure whats what!

Thanks
 
Ok, so that works nicely to copy the data accross, however it doesnt clear what is currently in the 'Most Recent Entry' memo field.

I would also like to add todays date onto the first line of the 'Most Recent Entry' memo box after the previous load of data has been cleared.

Can you help?

Thanks
 
Me.OldMemoField = Trim(Me.OldMemoField) & vbNewline & vbNewLine & Date() & vbnewline & Trim(Me.NewMemoField)

Will insert a date between each new block of text. The latest text will always be the latest text unless you overwrite it. If you want to clear it then highlight the text and press delete.

On this forum members have a tendancy to use made up names when offering solutions in most cases they do not know what the table names and field names are called, therefore they make them up. It it assumed that the poster will realise this and substitute the made up names their real names.
 
Thanks!

After a little more thinking I went with a solution like this:

Private Sub Command33_Click()
Dim contents As String
If Me.Information = "" Then
Me.Information = Trim(Me.MostRecentEntry)
Me.MostRecentEntry = Date & ": "
Else
contents = Trim(Me.Information)
Me.Information = Trim(Me.MostRecentEntry) & vbNewLine & vbNewLine & contents
Me.MostRecentEntry = Date & ": "
End If
End Sub

And set a default value of the date and ": " in the Most Recent Entry field so that this is present as soon as the user goes to enter data
 

Users who are viewing this thread

Back
Top Bottom