Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving someing but updating while not overwriting

Status
Not open for further replies.

alh1002

Technical User
Mar 27, 2006
41
US
I have a field that I want to time stamp everytime there is a change. But I don't want to erase what was there. So I can't simply put Me.comment= date & time, I tried the below code but it breaks. How can I just append something witht the date and time?



Private Sub cmdSaveAll_Click()

'save all changes to current record
Me.comments = "Modified" & Date & " " & Time() & " /" & rsNAV!notes

Call SaveCurrentRecord

End Sub
 
Somthing like this?:
Code:
Me!comments = Me!comments & vbCrLf & "Modified " & Now() & " /" & rsNAV!notes
Ken S.
 
but it breaks
any chance you could post the whole error message ?
What is rsNAV!notes ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
rsNAV!notes is the record set and on the table the column is notes.

by inserting the code suggested I get an run time error
'-2147217887 (8004e21)'
Multipe-step operation generated errors. Check each status value.


So the base code, which works but doesn't do the automatic appending of the modified time.


Private Sub cmdSaveAll_Click()
'save all changes to current record
Call SaveCurrentRecord
End Sub

where

Sub SaveCurrentRecord()

'save the values in the controls on the form to the current record
'in the local disconnected recordset.
If Not rsNAV1.BOF And Not rsNAV1.EOF Then

rsNAV1!notes = Me.comments

End If

End Sub


it is adding this part reassinging Me.comments which causing the problem, not sure if it should go on the click command or Sub SaveCurrentRecord()

but I haven't gotten the right order yet.

 
And this ?
Private Sub cmdSaveAll_Click()
'save all changes to current record
Me.comments = "Modified " & Now & " /" & Me.comments
Call SaveCurrentRecord
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
that gives the same multi step error as listed above

I inserting a variable to make it simplier, and still get the multi step operation error


Dim temp As String
temp = "Modified " & Now
Me.comments = temp & Me.comments
 
Try passing Me.comments as an argument?

Call SaveCurrentRecord(Me.Comments)

Or possibly saving record on Click event
...
Me.refresh
Call SaveCurrentRecord
End sub


just for the record, for legibility, why don't you add
a line feed to the Comments field.

Me.comments = _
"Modified " & Now & " /" & Me.comments & vbCrLf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top