When I delete one Remark in one record ..it deletes all

I have a code that writes the same Remark to all the records that have a value in BC1.  Bu when I delete one Remark, it deletes all the remark in the rest of the records that have a value in BC1.  

Private Sub Remarks1_AfterUpdate()
 Dim rst As DAO.Recordset
   Dim strRemarks As String
   
   Set rst = CurrentDb.OpenRecordset("Final_Table")
   strRemarks = Me.Remarks1

   Do While Not rst.EOF
      rst.Edit
        If Nz(rst![BC1Chng1]) <> "" Then
         rst![Remarks1] = strRemarks
      Else
         rst![Remarks1] = Null
      End If
      rst.Update
      rst.MoveNext
   Loop
      

End Sub

Open in new window


Not sure which line is doing this.  I have this code as an After Update event
Jass SainiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
It is this line:

         rst![Remarks1] = Null

Comment it out if you don't want this.

/gustav
0
PatHartmanCommented:
You are not selecting a specific record you want to update.  You are looping through the whole table and deleting all values.
0
Jass SainiAuthor Commented:
Hello Gustav,

I tried to comment that line out and still if I comment out and delete.  It deletes all the Remarks1 "Input" in all the records

Pat--I want it to loop through when I am making a input into the Remarks1 field to copy the comment to all the records.  But if I delete a comment from the Remarks1 field ...I just want to be able to delete just that one.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Gustav BrockCIOCommented:
Then correct like this to just exit the sub:
Private Sub Remarks1_AfterUpdate()
   Dim rst As DAO.Recordset
   Dim strRemarks As String

   strRemarks = Me.Remarks1   
   If strRemarks = "" Then Exit Sub

   Set rst = CurrentDb.OpenRecordset("Final_Table")
   Do While Not rst.EOF
      rst.Edit
        If Nz(rst![BC1Chng1]) <> "" Then
         rst![Remarks1] = strRemarks
      Else
         rst![Remarks1] = Null
      End If
      rst.Update
      rst.MoveNext
   Loop
      

End Sub

Open in new window

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jass SainiAuthor Commented:
Thank You that worked
0
Gustav BrockCIOCommented:
You are welcome!

/gustav
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.