A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date stamp a notes field



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old November 24th, 2006, 09:59 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Date stamp a notes field

What about

Me.Notes = Now() & " " & Me.Notes

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"arogers via AccessMonster.com" u29179@uwe wrote in message
news:69c879e4291ca@uwe...
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.