If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Date stamp a notes field
How can I add a current Date/Time stamp to my Notes field (Memo) each time I
add data to the field and ensure the most recent Date/Time is always at the top of the field. (Access 97) Thanks Allan -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200611/1 |
#2
|
|||
|
|||
Date stamp a notes field
On Fri, 17 Nov 2006 21:22:28 GMT, arogers via AccessMonster.com wrote:
How can I add a current Date/Time stamp to my Notes field (Memo) each time I add data to the field and ensure the most recent Date/Time is always at the top of the field. (Access 97) Thanks Allan Code the Notes AfterUpdate event: Me![Notes] = Now() & vbNewLine & Me![Notes] -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
Date stamp a notes field
Thanks,but this just lists all the dates at the top and all the data
underneath e.g 18/11/2006 00:09:38 18/11/2006 00:09:07 blah, blah,blah dah, dah,dah I would like it: 18/11/2006 00:09:38 dah, dah,dah 18/11/2006 00:09:07 blah, blah,blah so the data is under each dated/time entry Many thanks Allan fredg wrote: How can I add a current Date/Time stamp to my Notes field (Memo) each time I add data to the field and ensure the most recent Date/Time is always at the [quoted text clipped - 3 lines] Allan Code the Notes AfterUpdate event: Me![Notes] = Now() & vbNewLine & Me![Notes] -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Date stamp a notes field
On Sat, 18 Nov 2006 00:14:03 GMT, "arogers via AccessMonster.com"
u29179@uwe wrote: Thanks,but this just lists all the dates at the top and all the data underneath e.g 18/11/2006 00:09:38 18/11/2006 00:09:07 blah, blah,blah dah, dah,dah I would like it: 18/11/2006 00:09:38 dah, dah,dah 18/11/2006 00:09:07 blah, blah,blah so the data is under each dated/time entry Might you consider normalizing this data, rather than jamming it all into one difficult-to-search, impossible-to-sort Memo field? If you had a Notes table with three fields (a foreign key to the primary key of this table, a Date/Time field defaulting to Now, and a Text or Memo field for the note), you could get the effect that you want by using a continuous Subform. John W. Vinson[MVP] |
#5
|
|||
|
|||
Date stamp a notes field
On Sat, 18 Nov 2006 00:14:03 GMT, arogers via AccessMonster.com wrote:
Thanks,but this just lists all the dates at the top and all the data underneath e.g 18/11/2006 00:09:38 18/11/2006 00:09:07 blah, blah,blah dah, dah,dah I would like it: 18/11/2006 00:09:38 dah, dah,dah 18/11/2006 00:09:07 blah, blah,blah so the data is under each dated/time entry Many thanks Allan fredg wrote: How can I add a current Date/Time stamp to my Notes field (Memo) each time I add data to the field and ensure the most recent Date/Time is always at the [quoted text clipped - 3 lines] Allan Code the Notes AfterUpdate event: Me![Notes] = Now() & vbNewLine & Me![Notes] Where are you adding your data? At the beginning of the text? It should work exactly as you have requested. If you add the data at the end of the text and expect it to move to the top, no, it won't do that. Code the Notes enter event: Me.[Notes].SelStart = 0 to start at the top of the field. Always tab into the field. Don't use the mouse for entry. If that is too difficult for the user to handle, then add an unbound control to the form. Set it's AfterUpdate event to : Me![Notes] = Now() & vbNewLine & Me![ControlName] & Me![Notes] Me![ControlName] = Null Set the [Notes] control's Locked property to Yes. Use [ControlName] to enter the added text. It will then be placed at the top of the Notes field. The user can still scroll though the text but cannot enter the Notes control directly for editing. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#6
|
|||
|
|||
Date stamp a notes field
Hi Allan,
Fred’s comments below are perfectly good and succinct. Here are my comments that may help support Fred’s approach to the problem and hopefully provide additional detailed clarification. Please forgive me if I go into some elementary details for the sake of readers less experienced. In Form design view, from the Toolbox bar, drag the text box icon ab| to a suggested spot just above your Notes (Memo-type) field control. Highlight your unbound control and open the property sheet (Go to Menu Bar, click View, click Properties). Name the unbound control, “CommentUnbound” (or any other name you wish) and keep the record control line blank (i.e. unbound). Click the Event tab in the Property Sheet and place your cursor on the line, “After Update”. When your cursor is on that line, you will see two control buttons on the far right side of that line. Click the first button and highlight the words, “Event Procedure” on the drop-down list. Then click the second button (ellipsis…) and you will be taken to the Event Procedure screen. Between the two existing lines, “Private Sub CommentUnbound After Update () and “End Sub”, add your event procedure, as shown below: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Private Sub CommentUnbound After Update () ADD YOUR EVENT PROCEDURE HERE (See Below) End Sub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Assuming your unbound comment control is named “CommentUnbound”, and your Memo type field is named “Notes”, remembering that the control names might be different than the actual field names (at your discretion), here is a suggested event procedu -------------- DESCENDING ORDER ------------------- Private Sub CommentUnbound_AfterUpdate() Me.Notes = vbNewLine & vbNewLine & Format(Now(), “d-mmm-yy hh:nn ”) & Me.CommentUnbound &” “& Me.Notes Me.CommentUnbound = Null DoCmd.GotoControl “CommentUnbound” End Sub ----------------------------------------------------------------- Note #1: I intentionally formatted Now() to fit European standards: d-mmm-yy hh:nn to produce 18 Nov 06 1530, as your reply to Fred revealed you are outside of the U.S.A. Note also in the Event Procedure above that there are spaces after hh:nn “ which allows space between the date/time stamp and the actual comment text. American USA standards would be: m-d-yy h:nn am/pm to produce 11-18-06 3:30 pm The above date/time formatting, in my opinion, is visually more attractive and minimizes space when the focus is on the text, not the date/time stamp. Note #2: If your comment entries are usually one liners, that is very, very brief. You could use only one NewLine, rather than the suggested two, which may visually aid a person reviewing all the comment entries. If vbNewLine does not work in an application using an earlier version of Access, you might try its equivalent, chr(13) & chr(10), which is similar to the typewriter’s “carriage return, line feed”. The last line in the Event Procedure is not critical. The “DoCmd.GoToControl “CommentUnbound” allows the cursor to remain in the unbound control for another entry. The procedure above allows for a double line feed so that the next entry into the Notes field control will appear two lines above the previous entry for easy reviewing. Your comments therefore appear in descending order with the latest at the top. Also, there is a way to capture the name of the person logging in to the network and if you have a field in your table such as “UpdatedBy” or “Modifier” ,etc., you could add that name to your Date/Time stamp so that you have a date and time and worker’s name of person adding comments to the Memo. Explaining how to perform this task, however, requires a longer discussion that doesn’t address your immediate needs. SHOULD I LOCK THE NOTES FIELD CONTROL? Locking the Notes field control and keying in text to an unbound control is not always desirable, as staff can more easily type and review the comments if they type directly into the Notes control (field). There are also many times that the user will need to edit the text he/she enters, particularly if the text is long. Your method doesn’t allow corrections or edits if the memo field is locked. A worker may review the text entered into the Memo and decide minutes later that the information needs to be modified. The only recourse is to make another entry explaining a correction or addition to a previous entry. It could be tiring to whoever has to read all the notes/comments in the Memo field. Most workers will, however, find the unbound control to enter comments a helpful tool, while the Notes memo field control remains unlocked, open for editing. If you are working with a trustworthy team and you yourself set a trusting work environment, there should be no reason to lock your workers out of the Notes field. An example might be social worker staff assigned to cases or clients having full responsibility to document all communications between social worker and client. That is, basically all data entries are made by the same person assigned to that specific record. Professionals in this kind of trusting environment are more focused on health and welfare of clients than on modifying the record’s data for some self-serving reasons. A daily backup system on a shared drive, provides another level of data integrity that helps a supervisor feel at ease in maintaining a trusting work environment. Hope this helps. If our answers (Fred’s and mine) were helpful to you, please click “Yes” on the appropriate buttons so other readers can refer to this problem/answer set as being helpful. ------- Tank "arogers via AccessMonster.com" wrote: How can I add a current Date/Time stamp to my Notes field (Memo) each time I add data to the field and ensure the most recent Date/Time is always at the top of the field. (Access 97) Thanks Allan -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200611/1 |
#7
|
|||
|
|||
Date stamp a notes field
Tank, followed your instructions and all I got was a sintax error with the
Private sub highlited and the first two lines of the code in red! Allan Tank wrote: Hi Allan, Fred’s comments below are perfectly good and succinct. Here are my comments that may help support Fred’s approach to the problem and hopefully provide additional detailed clarification. Please forgive me if I go into some elementary details for the sake of readers less experienced. In Form design view, from the Toolbox bar, drag the text box icon ab| to a suggested spot just above your Notes (Memo-type) field control. Highlight your unbound control and open the property sheet (Go to Menu Bar, click View, click Properties). Name the unbound control, “CommentUnbound” (or any other name you wish) and keep the record control line blank (i.e. unbound). Click the Event tab in the Property Sheet and place your cursor on the line, “After Update”. When your cursor is on that line, you will see two control buttons on the far right side of that line. Click the first button and highlight the words, “Event Procedure” on the drop-down list. Then click the second button (ellipsis…) and you will be taken to the Event Procedure screen. Between the two existing lines, “Private Sub CommentUnbound After Update () and “End Sub”, add your event procedure, as shown below: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Private Sub CommentUnbound After Update () ADD YOUR EVENT PROCEDURE HERE (See Below) End Sub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Assuming your unbound comment control is named “CommentUnbound”, and your Memo type field is named “Notes”, remembering that the control names might be different than the actual field names (at your discretion), here is a suggested event procedu -------------- DESCENDING ORDER ------------------- Private Sub CommentUnbound_AfterUpdate() Me.Notes = vbNewLine & vbNewLine & Format(Now(), “d-mmm-yy hh:nn ”) & Me.CommentUnbound &” “& Me.Notes Me.CommentUnbound = Null DoCmd.GotoControl “CommentUnbound” End Sub ----------------------------------------------------------------- Note #1: I intentionally formatted Now() to fit European standards: d-mmm-yy hh:nn to produce 18 Nov 06 1530, as your reply to Fred revealed you are outside of the U.S.A. Note also in the Event Procedure above that there are spaces after hh:nn “ which allows space between the date/time stamp and the actual comment text. American USA standards would be: m-d-yy h:nn am/pm to produce 11-18-06 3:30 pm The above date/time formatting, in my opinion, is visually more attractive and minimizes space when the focus is on the text, not the date/time stamp. Note #2: If your comment entries are usually one liners, that is very, very brief. You could use only one NewLine, rather than the suggested two, which may visually aid a person reviewing all the comment entries. If vbNewLine does not work in an application using an earlier version of Access, you might try its equivalent, chr(13) & chr(10), which is similar to the typewriter’s “carriage return, line feed”. The last line in the Event Procedure is not critical. The “DoCmd.GoToControl “CommentUnbound” allows the cursor to remain in the unbound control for another entry. The procedure above allows for a double line feed so that the next entry into the Notes field control will appear two lines above the previous entry for easy reviewing. Your comments therefore appear in descending order with the latest at the top. Also, there is a way to capture the name of the person logging in to the network and if you have a field in your table such as “UpdatedBy” or “Modifier” ,etc., you could add that name to your Date/Time stamp so that you have a date and time and worker’s name of person adding comments to the Memo. Explaining how to perform this task, however, requires a longer discussion that doesn’t address your immediate needs. SHOULD I LOCK THE NOTES FIELD CONTROL? Locking the Notes field control and keying in text to an unbound control is not always desirable, as staff can more easily type and review the comments if they type directly into the Notes control (field). There are also many times that the user will need to edit the text he/she enters, particularly if the text is long. Your method doesn’t allow corrections or edits if the memo field is locked. A worker may review the text entered into the Memo and decide minutes later that the information needs to be modified. The only recourse is to make another entry explaining a correction or addition to a previous entry. It could be tiring to whoever has to read all the notes/comments in the Memo field. Most workers will, however, find the unbound control to enter comments a helpful tool, while the Notes memo field control remains unlocked, open for editing. If you are working with a trustworthy team and you yourself set a trusting work environment, there should be no reason to lock your workers out of the Notes field. An example might be social worker staff assigned to cases or clients having full responsibility to document all communications between social worker and client. That is, basically all data entries are made by the same person assigned to that specific record. Professionals in this kind of trusting environment are more focused on health and welfare of clients than on modifying the record’s data for some self-serving reasons. A daily backup system on a shared drive, provides another level of data integrity that helps a supervisor feel at ease in maintaining a trusting work environment. Hope this helps. If our answers (Fred’s and mine) were helpful to you, please click “Yes” on the appropriate buttons so other readers can refer to this problem/answer set as being helpful. ------- Tank How can I add a current Date/Time stamp to my Notes field (Memo) each time I add data to the field and ensure the most recent Date/Time is always at the [quoted text clipped - 3 lines] Allan -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200611/1 |
#8
|
|||
|
|||
Date stamp a notes field
Hi Allan,
I'm sorry for the confusion. The first two lines are really supposed to be on the same line. When I added the code in my reply to you, the posting pushed a portion of the line onto a second line. Would you mind moving the second line to the end of the first line? I think that will correct your problem. If I had realized the posting might split the code, I would have introduced the underscore to make the split. Properly splitting the line helps the reader see the entire code without having to scroll left and right to view the entire line. The underscore is sometimes referred to as a "Visual Basic line-continuation character". As you probably know, anytime you want to continue a line of code on a second line, you can type a space followed by this character (the underscore), and then continue on a new line. Visual Basic interprets the code as if it were all on one line. Here's perhaps how I should have displayed the event procedure in your example (Note the space after & followed by the underscore): Private Sub CommentUnbound_AfterUpdate() Me.Notes = vbNewLine & vbNewLine & Format(Now(), “d-mmm-yy hh:nn ”) & _ Me.CommentUnbound &” “& Me.Notes Me.CommentUnbound = Null DoCmd.GotoControl “CommentUnbound” End Sub So, you have two alternatives: (1) Put both lines on one line; or (2) Use the Space/Underscore to break the code onto two lines. Please let me know if this helps solve your problem. ----- Tank ---------------------------------------------- "arogers via AccessMonster.com" wrote: Tank, followed your instructions and all I got was a syntax error with the Private sub highlighted and the first two lines of the code in red! Allan |
#9
|
|||
|
|||
Date stamp a notes field
Hi Tank
Tried it again as you suggest, with and without the underscore. Still comes up with a sintax error. The nearest i have got is with: Private Sub Notes_AfterUpdate() Me.Notes = Me.Notes & " " & Now() & " " End Sub It stamps the notes with date and time but they are always at the latest note is always at the bottom and not at the top. Regards Allan Tank wrote: Hi Allan, I'm sorry for the confusion. The first two lines are really supposed to be on the same line. When I added the code in my reply to you, the posting pushed a portion of the line onto a second line. Would you mind moving the second line to the end of the first line? I think that will correct your problem. If I had realized the posting might split the code, I would have introduced the underscore to make the split. Properly splitting the line helps the reader see the entire code without having to scroll left and right to view the entire line. The underscore is sometimes referred to as a "Visual Basic line-continuation character". As you probably know, anytime you want to continue a line of code on a second line, you can type a space followed by this character (the underscore), and then continue on a new line. Visual Basic interprets the code as if it were all on one line. Here's perhaps how I should have displayed the event procedure in your example (Note the space after & followed by the underscore): Private Sub CommentUnbound_AfterUpdate() Me.Notes = vbNewLine & vbNewLine & Format(Now(), “d-mmm-yy hh:nn ”) & _ Me.CommentUnbound &” “& Me.Notes Me.CommentUnbound = Null DoCmd.GotoControl “CommentUnbound” End Sub So, you have two alternatives: (1) Put both lines on one line; or (2) Use the Space/Underscore to break the code onto two lines. Please let me know if this helps solve your problem. ----- Tank ---------------------------------------------- Tank, followed your instructions and all I got was a syntax error with the Private sub highlighted and the first two lines of the code in red! Allan -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200611/1 |
#10
|
|||
|
|||
Date stamp a notes field
Hi Tank
Tried it again as you suggest, with and without the underscore. Still comes up with a sintax error. The nearest i have got is with: Private Sub Notes_AfterUpdate() Me.Notes = Me.Notes & " " & Now() & " " End Sub It stamps the notes with date and time but they are always at the latest note is always at the bottom and not at the top. Regards Allan Tank wrote: Hi Allan, I'm sorry for the confusion. The first two lines are really supposed to be on the same line. When I added the code in my reply to you, the posting pushed a portion of the line onto a second line. Would you mind moving the second line to the end of the first line? I think that will correct your problem. If I had realized the posting might split the code, I would have introduced the underscore to make the split. Properly splitting the line helps the reader see the entire code without having to scroll left and right to view the entire line. The underscore is sometimes referred to as a "Visual Basic line-continuation character". As you probably know, anytime you want to continue a line of code on a second line, you can type a space followed by this character (the underscore), and then continue on a new line. Visual Basic interprets the code as if it were all on one line. Here's perhaps how I should have displayed the event procedure in your example (Note the space after & followed by the underscore): Private Sub CommentUnbound_AfterUpdate() Me.Notes = vbNewLine & vbNewLine & Format(Now(), “d-mmm-yy hh:nn ”) & _ Me.CommentUnbound &” “& Me.Notes Me.CommentUnbound = Null DoCmd.GotoControl “CommentUnbound” End Sub So, you have two alternatives: (1) Put both lines on one line; or (2) Use the Space/Underscore to break the code onto two lines. Please let me know if this helps solve your problem. ----- Tank ---------------------------------------------- Tank, followed your instructions and all I got was a syntax error with the Private sub highlighted and the first two lines of the code in red! Allan -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200611/1 |
|
Thread Tools | |
Display Modes | |
|
|