473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can I set a memo field so that so that it can retain its old & new values?

I have a comments field on a form. I want the field value to be copied to a variable, so that when the user updates or changes the value of the field, the field value will be something like:

Expand|Select|Wrap|Line Numbers
  1. Dim OldValue as Variant
  2. Dim NewValue as Variant
  3. OldValue & vbCrLf & vbCrLf & NewValue & vbCrLf & Now
so that a constant log is kept for changes to that field?

Would something like the above work? And if so, which event would I put it in?

Any help appreciated.
Apr 5 '11 #1

✓ answered by TheSmileyCoder

What version of Access are you using? I belive that access 2007 has an append only memo field built into it, though I have not used it.

The advantage of a seperately linked table would be that you could better keep track of QA data, such as who created it and when. Now you example does add the date, but it would not be in a searchable format, whereas that would be possible if the creation date had its own field in a seperate table.

Another option is to store it in a seperate field, but display it in a combined memo field. Depends on your requirements.

One thing to note though, is that I would recommend against tying it to the afterupdate, since I could imagine a situation in which a user starts to type something, then regrets and goes to cancel, but as soon as the focus leaves the field, the memo gets update, and so also does your memofield. You could use a similar approach but tie the update to the forms update event instead. Just a thought.

6 2052
Rabbit
12,516 Expert Mod 8TB
I wouldn't recommend that method to keep a history of comments. You should have a separate comment table that is linked to that table.
Apr 5 '11 #2
Thanks Rabbit, I see what you are saying, I should set up a side table on a one-to-many relationship. I will be displaying the form in a datasheet view, and the comments are just for short notes for the life of an order.

I will keep pecking at it, but will probably go with a subdatasheet view using the linked table. :)
Apr 5 '11 #3
I have cracked it! I am a little bit worried that I am going to have problems though. Would I get any advantage using a linked table?

Here is what I used
Expand|Select|Wrap|Line Numbers
  1. Private Sub memComments_AfterUpdate()
  2. Dim MyOldValue As Variant
  3. Dim MyNewValue As Variant
  4. Dim MyNewFieldValue As Variant
  5.  
  6. MyOldValue = Me.ActiveControl.OldValue
  7. MyNewValue = Me.ActiveControl.Value
  8. MyNewFieldValue = MyNewValue & vbCrLf & Format(Now, "dd/mm/yy hh:nn:ss") & vbCrLf & vbCrLf & MyOldValue
  9. Me.ActiveControl.Value = MyNewFieldValue
  10. End Sub
  11.  
Apr 5 '11 #4
Rabbit
12,516 Expert Mod 8TB
There is a problem with what you're trying to do in the code. If they typed in this is a comment. and if they don't overwrite it and instead append to it. this is a comment. this is a comment too.. Then when the code runs, you get this is a comment. this is a comment. this is a comment too.. Plus there would be no way of deleting the duplication without going into the table directly.
Apr 5 '11 #5
TheSmileyCoder
2,322 Expert Mod 2GB
What version of Access are you using? I belive that access 2007 has an append only memo field built into it, though I have not used it.

The advantage of a seperately linked table would be that you could better keep track of QA data, such as who created it and when. Now you example does add the date, but it would not be in a searchable format, whereas that would be possible if the creation date had its own field in a seperate table.

Another option is to store it in a seperate field, but display it in a combined memo field. Depends on your requirements.

One thing to note though, is that I would recommend against tying it to the afterupdate, since I could imagine a situation in which a user starts to type something, then regrets and goes to cancel, but as soon as the focus leaves the field, the memo gets update, and so also does your memofield. You could use a similar approach but tie the update to the forms update event instead. Just a thought.
Apr 5 '11 #6
Hello TheSmileyCoder,
I am using Office 2010 Professional, but have only recently upgraded to it. Previously used Access 2000, and I am still getting used to where things are.

I have noted your comments regarding the appropriate event, and will give it a try. Not quite sure how it will work though. I guess I just change the Me.ActiveControl. references to me.ActualControlName and put it in the Forms.Afterupdate event.

Thanks for all the help.

Tony
Apr 7 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: PMB | last post by:
Thank you in advance for any and all assistance. I'm trying to input data from strings to a memo field. I would like to know how to check first to see if there is text there currently and if so...
6
by: Matt | last post by:
I'm having difficulty with trying to update a Access memo field through an SQL statement where the value I'm trying to pass is longer than 255 characters. The field is being truncated. I'm using...
7
by: midlothian | last post by:
Does using CStr on a memo field truncate it to 255 characters? Seems like this is happening with some data in my tables. Is there a way around this?
9
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo...
4
by: Vikas123456 | last post by:
I have 2 tables with memo field, when selecte values from both the table with union query I face a problem of 1st 255 chars. of the memo field. How to get the full values of the column? Rgds, ...
0
NeoPa
by: NeoPa | last post by:
**********
1
by: rlntemp-gns | last post by:
Re: Access 2003/Word 2003 I have about 100 motivational documents that I am wanting to import into a small database and put a front end on it that would allow the user to select one, read it and...
5
by: cosmodango | last post by:
I have spent several days on this. I hope someone can help me. I am using Acccess 2000. I have a memo field where I have cut and pasted bulleted/numbered lists from Microsoft Word. I want to...
7
by: ARC | last post by:
This is taken from the "What's New in Access 2007" page. However, I've looked through all the properties of a text field memo box, and cannot find the append only option. Does anyone know how to...
1
thewesties
by: thewesties | last post by:
Could somebody please help me before I dump a gallon of water on my pc! I am very happy to have come across this site on the internet. TheScripts has helped me through so many issues to this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.