adding to comments for multiple records

cbearden

Registered User.
Local time
Today, 10:00
Joined
May 12, 2004
Messages
84
I have a comments on my form. I have contacts with them having from 1 to many customers accts. I am trying to come up with a way to update the comments for a contact that adds those comments to all their customers records...but not to those that have been closed.
How would I add these comments to the comments on the form without overwriting the current comments.

Comments - Memo
Contact - Text

It's quite a pain, copying and pasting from record to record.

Thanks
 
cbearden,

Comments ...
8/23/2005
Old Memo Contents ...


Code:
DoCmd.RunSql "Update Customers " & _
             "Set    Memo = Memo & " & Me.Comments & vbCrLf & Date & vbCrLf & " " & _
             "Where  [Contact] = '" & Me.Contact & "'"

If the Comments can contain either single/double quotes, then I think you'll
have to use a recordset for the update:

Code:
Dim dbs As DAO.Database
Dim rst As DAO.Recordset

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Select * From Contacts Where [Contact] = '" & Me.Contact & "'")

While Not rst.EOF And Not rst.BOF
   rst.Edit
   rst!Memo = Me.Comments & vbCrLf & Date & vbCrLf & rst!Memo
   rst.Update
   rst.MoveNext
   Wend


Wayne
 

Users who are viewing this thread

Back
Top Bottom