Memo Field, with date/time stamp (1 Viewer)

mattP

Registered User.
Local time
Today, 09:08
Joined
Jun 21, 2004
Messages
87
Ok I have had a good search around the pages and I have found a lot of examples that nearly do what I want but am still having some problems.

Basically I have a DB that monitors escalations I ( and several colleagues) are dealing with, I have a memo field that requires updating with notesa and I want to place a time/date stamp in the notes first almong with the user who entered the data. This cannot overwrite original data in the memo field as I need to keep a rolling history of updates (for future reporting).

I was looking to make the updated notes field as a read only and have an update button on the main form that when clicked would open another form with a text box. Notes would be typed in and then when this for was closed it updates my main notes field with the text and the date time and user stamp.
I am hoping to get the text format as follows:

"Date/Time" "User"

" text"

I have found loads of references to date/time stamping etc but cannot get the above working

Any help would be appreciated, I have already used other bits of help and advice to get my DB up and running.

MattP
 

mattP

Registered User.
Local time
Today, 09:08
Joined
Jun 21, 2004
Messages
87
Sorry I seemed to have posted this twice, one of these posts can be deleted.

Thks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:08
Joined
Feb 28, 2001
Messages
26,996
With due respect, that design is probably not the best and that is why you are having trouble. Access is more naturally going to add a new record for you, not append text to an existing field in an existing record. Hence you are fighting Access's tendencies.

The way this is normally done is that your "notes" - which are related to some problem - go in a separate table. The records in the notes table include the problem ID code. You can make the table have a default value in a date field. You can use any of a dozen methods for getting a person's name, ID code, or initials into a field. Then enter your memo.

To display the notes, you would need a parent/child form setup. The notes would be the child entries. The problem would be the parent entry.
 

mattP

Registered User.
Local time
Today, 09:08
Joined
Jun 21, 2004
Messages
87
Date/Time stamp in a memo field

The Doc Man,

i have tried what you were suggesting, as a memo field is still restricted on the data it can store I did try the option of having a seperate table that would have a new entry everytime you added notes, this worked fine apart from the fact that I had the Date/Tiem set to now and as such is always autopoulated the bottom line of the datsheet view and therefore making it a valid record. o in my form I would see a date/tiem stamp, my text and then another date time stamp. Is there anyway to hide the last record or stop the autopopulate in the table ?

Thanks
 

WayneRyan

AWF VIP
Local time
Today, 09:08
Joined
Nov 19, 2002
Messages
7,122
Matt,

You can add a new "unbound" field to your form. Let's call it txtMemoAdd.
Then use its AfterUpdate event to do the following:

Code:
Me.YourRealMemoField = Me.YourRealMemoField & vbCrLf & Now() & vbCrLf & Me.txtMemoAdd
Me.txtMemoAdd = ""

That will take your current memo field,
Add a Carriage-Return, LineFeed to it,
Add a Date/Time Stamp,
Add another Carriage-Return, LineFeed,
Add the new update text,
Finally, it will clear your new "scratchpad" control.

Wayne
 
Last edited:

mattP

Registered User.
Local time
Today, 09:08
Joined
Jun 21, 2004
Messages
87
Wayne,

Thanks for this, i have tried the code and got it all working.
It seems so simple when you know how...hopefully I will be able to advise others in the future :)
 

nasferatu

New member
Local time
Today, 05:08
Joined
Apr 25, 2007
Messages
2
I know this is an old post, but this almost exactly what I'm looking for to finish my incident tracking db.

I'm honestly not too adept at building macros and/or expressions, but would appreciate any help in getting the above noted AfterUpdate script to run.

Thanks in advance.

btw, I have so far done the following...

Created a small table with only a memo field.
Created a form with the addition of an unbound "text box"
Selected the "Text Box" and right clicked properties
In the Event tab, I selected [Event Procedure] and then "..."

Without actually knowing what i was doing, I merely pasted the above script, and assumed the skies would open up and my work would be finished.... uh...not so.

Help.
 

nasferatu

New member
Local time
Today, 05:08
Joined
Apr 25, 2007
Messages
2
After a bit of digging and testing, I think I got it. what I'm looking for now is how to add a name with the timestamp. I suppose I'll keep digging.. :D
 

WayneRyan

AWF VIP
Local time
Today, 09:08
Joined
Nov 19, 2002
Messages
7,122
nasferatu,

If you need some help on this post some details.

Wayne
 

Samrasr

Registered User.
Local time
Today, 09:08
Joined
May 5, 2007
Messages
21
Help with a MEMO Box

I have a form which has a MEMO box. I want my users to type in the memo box, each time they type in the box, i want the box to expand/grow as they type or hit return. I have seen this on another database but cant figure the code as its another version.

Whats the best way of doing this and please explain in basic as im not good at computers.

At the moment my users have to use the scroll bar which i do not like.

Please see the Photos for more information.

Form is the database im working on now which has a scroller.
FORM 2 is the database i want the memo to look like.
 

Attachments

  • FORM 2.jpg
    FORM 2.jpg
    94.8 KB · Views: 789
  • Form.jpg
    Form.jpg
    46.4 KB · Views: 695
Last edited:

Moniker

VBA Pro
Local time
Today, 04:08
Joined
Dec 21, 2006
Messages
1,567
The CanGrow property of the memo field doesn't do it for you? Is the form set to AutoResize?
 

Samrasr

Registered User.
Local time
Today, 09:08
Joined
May 5, 2007
Messages
21
Hi

It dont work? the can grow option dont work

Any other options?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 09:08
Joined
Sep 12, 2006
Messages
15,613
i do what you want all the time

i add a note stamped by date and currentuser on environ("username")

(gives date/accessname/windows login name/)

Use a large text box with a vertical scroll bar.
lock the text box if you don't want to be able to edit it directly.

I show a small notes box on most forms, and expand it with a largeer popup form, if anyone clicks a transparent button overlaying the field
 

Markjp

New member
Local time
Today, 02:08
Joined
Jun 27, 2012
Messages
4
Hi all,

I have joined this forum after seeing this thread in the hope that some kind soul can help me out. I am trying to achieve what Wayne and mattp have done by adding a time stamp to log contact notes to a notes memo field and can't for the life of me get it to work, Please help I'm going crazy!

Here is what I have done so far:

Created a table for customers
Created a Form to input their data with various fields from the table
Added a Contact Notes memo to the form (also from the table)
Added an unbound text box
In the unbound text box selected after update ... Code writer
In between the two existing lines of text added the code described above substituting yourRealMemoField for ContactNotes and substituting txtmemoadd for the name of the unbound field Text174

After doing this I have saved my database. And typed into the unbound text field and clicked my save button on the main form but it is not appearing in the
Contact notes memo just stays in the unbound texy box. Where am I going wrong? Does clicking a save button update the record or am I doing something else wrong?

Please can someone write out a step by step method of achieving what you guys have achieved and treat me like the idiot I am e.g step by step.

I would be eternally grateful!!!

Thanks in advance!!!

Mark
 

Thales750

Formerly Jsanders
Local time
Today, 05:08
Joined
Dec 20, 2007
Messages
2,061
Using this Code in the GotFocus Event
Code:
Me.MemoField = pubUserLoginName & " " & Now() & vbCr & vbLf & vbCr & vbLf & Me.MemoField
inserts the above into the Memo Field as a new section.

Is there a way to force the curser to the beginning of the last line of the new section?

Thanks
 

Mark_

Longboard on the internet
Local time
Today, 02:08
Joined
Sep 12, 2017
Messages
2,111
Are you asking for something like
Code:
Me.MemoField.SelStart = Len(Me.MemoField)
So you select the last character in the textbox control?
Or are you trying to get it after the username/datestamp?
Code:
DIM asHeader as String
DIM aiSelect as Integer

asHeader = pubUserLoginName & " " & Now() & vbCr & vbLf & vbCr & vbLf
aiSelect = LEN(asHeader)

Me.MemoField = asHeader & Me.MemoField
Me.MemoField.SelStart = aiSelect

The term "Last line of the new section" is slightly ambiguous, but I hope that will help you identify WHERE you want to place the cursor.

P.S. I'm still in favor of multiple child records. Makes it FAR EASIER to track when each was inserted for reporting purposes. All notes in a single memo means you can't compare across instances easily. Makes if very difficult to see if the same item is reported during a given time period. Much more important, you can't assign due dates for each part of the note.
 

Thales750

Formerly Jsanders
Local time
Today, 05:08
Joined
Dec 20, 2007
Messages
2,061
Hey Mark,

First to clarify: I want the curser to be inserted right after the header, thanks for the info.

This situation is unique. Normally, I would not append to an existing field. It's being used in a many to one, as opposed to the traditional one to many.
 
Last edited:

Mark_

Longboard on the internet
Local time
Today, 02:08
Joined
Sep 12, 2017
Messages
2,111
Then the second part I posted should work. If its a little too far, subtract two for the later CRLF combo.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:08
Joined
May 7, 2009
Messages
19,169
You can try this:

Dim varNow as Variant
VarNow=Now
Me.MemoField = pubUserLoginName & " " & varNow & vbCr & vbLf & vbCr & vbLf & Me.MemoField
Me.MemoField.SelStart=len(pubUserLoginName & " " & varNow & vbCr)


'****
Note MemoField should be the name of the textbox control and not the name of the bound field for thus to work.
 

Users who are viewing this thread

Top Bottom