Update tblYourTableNameGoesHere
SET YourValueJudgementFieldNameGoesHere = "Good"
WHERE tblYourTableNameGoesHere.Cash = 100
However, that actually indicates a problem with table design to do that, so let's get a clearer description of the table itself and the basis for wanting to do this so we can help you correct the table design.
On the other hand, you asked a different question, as well.
"...how to repeat this code in each filed in recod[sic]"
And that is another table design problem on the face of it. Again, details about the table and the process are important to understanding how to correct the table design.
However, it is possible that you have a reason for thinking VBA is the way to go. Tell us the type of database structure you are using including where you thought you might want to use that code snippet you showed us. There is always more than one way to skin a cat, so it helps to know which kind of cat we are skinning today.
Dim ctrl As Control
For Each ctrl In Me.Controls
Select Case ctrl.ControlType
Case acTextBox, acComboBox ', acCheckBox
'Debug.Print ctrl.Name & " = "; ctrl.Value
if ctrl.Value = 100 then
msgbox"good"
end if
Case Else
' ...
End Select
Next ctrl
Dim ctrl As Control
For Each ctrl In Me.Controls
Select Case ctrl.ControlType
Case acTextBox, acComboBox ', acCheckBox
'Debug.Print ctrl.Name & " = "; ctrl.Value
if ctrl.Value = 100 then
msgbox"good"
end if
Case Else
' ...
End Select
Next ctrl
Over the years, I've learned the hard way that providing answers that technically are accurate is less valuable than providing answers that address the real, unspoken, problem.
@Safari, either use conditional formatting or put your code into the Current event of the subform so it runs for each new record.
I'm pretty sure you don't actually want to pop up a message box for each record so you need to tell us EXACTLY what you are trying to make happen. Keep in mind that a continuous form or form in DS view is simply a single record form that you can see multiple instances of at one time. They do not work any differently than single view forms. Code run in the form affects the CURRENT record. But, with the multiple instance views, Access keeps only ONE set of properties so if you have unbound controls or if you set properties with code, ALL visible records will exhibit the same properties. That is what Conditional Formatting was intended to get around.
For example, if you want to highlight a record that has an error, you might have the following code in the form's Current event.
Code:
If IsNull(Me.SomeField) = true then
Me.txtSomeField.BackColor = vbRed
Else
Me.txtSomeField.BackColor = Me.BackColor
End If
So the form opens and the first record is fine. You click into the third record where you see an error and all instances of that field go red. That is because Access keeps only one instance of the form properties for use by ALL visible rows. This is a case where Conditional Formatting will solve the problem.
If you want to lock or unlock. Then you can do that with code because you do not care at all what the state of the other records are. All you care about is the state of the CURRENT record. If it is locked, you can't update it but if it is unlocked, you can.
Here's a picture of how Conditional Formatting works.
@Safari, either use conditional formatting or put your code into the Current event of the subform so it runs for each new record.
I'm pretty sure you don't actually want to pop up a message box for each record so you need to tell us EXACTLY what you are trying to make happen. Keep in mind that a continuous form or form in DS view is simply a single record form that you can see multiple instances of at one time. They do not work any differently than single view forms. Code run in the form affects the CURRENT record. But, with the multiple instance views, Access keeps only ONE set of properties so if you have unbound controls or if you set properties with code, ALL visible records will exhibit the same properties. That is what Conditional Formatting was intended to get around.
For example, if you want to highlight a record that has an error, you might have the following code in the form's Current event.
Code:
If IsNull(Me.SomeField) = true then
Me.txtSomeField.BackColor = vbRed
Else
Me.txtSomeField.BackColor = Me.BackColor
End If
So the form opens and the first record is fine. You click into the third record where you see an error and all instances of that field go red. That is because Access keeps only one instance of the form properties for use by ALL visible rows. This is a case where Conditional Formatting will solve the problem.
If you want to lock or unlock. Then you can do that with code because you do not care at all what the state of the other records are. All you care about is the state of the CURRENT record. If it is locked, you can't update it but if it is unlocked, you can.