Question : In Access 2007,

I have a form for client/community info. Towards the bottom is a comments field that I would like to be able to update with current comments with a date but also have the past comments kept as a reference. I don't care how they're stored, just that I can access them at any point to see what the previous comments were. The form is built directly from the table that feeds the information (no query here) which is how I'd like to keep it, however I can have a separate table for the comments like I have for billing that DOES use a query.

Answer : In Access 2007,

Do you mean that you only want to add new comments on this form, not view old ones?

In this case, add an unbound textbox, txtAddComment, with an AfterUpdate event procedure like this:

Private Sub txtAddComment_AfterUpdate()
If IsNull( txtAddComment ) then exit sub
Dim rs as DAO.Recordset
Set rs = CurrentDb.OpenRecordset( "tblComments" )
with rs
   .AddNew
   !RecordID = Me.RecordID ' this is the PK of the record on your form - CustomerID or whatever
   !CommentDate = Date ' or use Now if you want the time as well
   !CommentText = txtAddComment
   .Update
   .Close
End With
MsgBox "Comment added"
txtAddComment = Null
End Sub

Of course you don't need a subject line - that was just to make it easier to browse the comments.

--
Graham

Random Solutions  
 
programming4us programming4us