Time Stamp before text??

galvinjaf

Registered User.
Local time
Today, 06:36
Joined
Jan 5, 2016
Messages
108
For whatever reason, I can't seem to get my time stamp to appear before my text. Right now, my comment box places my newly written text followed by a time stamp and I'd like to reverse it. Any ideas?
 

Attachments

  • Time Stamp.JPG
    Time Stamp.JPG
    49.4 KB · Views: 71
yes change the code to add timestamp before text
 
Would you be able to guide me in the right direction to do that? I've attempted to switch the two lines of code, but it doesn't like the expression.
 
at the moment you are saying (in simple terms)

full comment = comment & date & time

change it to

fullcomment=date & time & comment
 
You are correct, and that is what I'm attempting to do. Being that I don't know code, I simply took the two lines of code and swapped them assuming that the order in which the code is written, it would swap the text and time stamp.

Attached is the error I get when I try to swap the lines of code.
 

Attachments

  • Code Error.JPG
    Code Error.JPG
    50.6 KB · Views: 78
This would be much easier in this instance if you posted the code and not a picture...

Code:
If IsNull(Me.txtNewComment) or Me.txtNewComment = "" Then 
	Msgbox "Please enter a comment before pressing the append comment button"
	Exit Sub
End If

	[COLOR="SeaGreen"]' You have already tested for a null or empty string new comment 
	' so the next bit doesn't need to check for that again, and is therefore even simpler.[/COLOR]
	
Me.txtComment = Now() & " - " & Me.txtNewComment & me.txtComment

Me.txtNewComment = ""
 
Last edited:
This is EXACTLY what I was looking for. One thing though, that isn't in this line of code, is that every time you make a comment or entry, that there is a new line. I think that was part of that second string which was to see if there was text and if so enter a new line?
 
I missed that - the bit you want to add to your string is VbNewLine .

To test for it try

Code:
if not isNull(Me.txtcomment) Then
            me.txtComment = VbNewLine & me.txtComment 
end if

before adding the new comments.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom