When I use below code, the data in the table is updated, but the msgbox after the FOR ... NEXT is not showing:
But when I use it without the "AND", it works fine:
Can anyone explain why, and what should I do to be able to include the "AND" part?
Thanks,
Anders
Code:
...
For counter = 1 To 10
If Not Me("chkSJABody" & counter).Value = False [COLOR="Red"]And Me("chkCanEdit" & counter).Value = False[/COLOR] Then
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblSJABody WHERE SJA_Step = '" & Me("txtSJA_Step" & counter) & "'")
With rs
.Edit
.Fields("BasicStep") = Me("txtBasicStep" & counter).Value
.Fields("Hazard") = Me("txtHazard" & counter).Value
.Fields("Consequence") = Me("txtConsequence" & counter).Value
.Fields("Measures") = Me("txtMeasures" & counter).Value
.Fields("PersonMeasures") = Me("txtPersonMeasures" & counter).Value
.Update
End With
Set db = Nothing
Set rs = Nothing
End If
Next counter
MsgBox("SJA is now waiting for OIM's approval.", vbOKOnly, "SJA updated")
...
But when I use it without the "AND", it works fine:
Code:
...
For counter = 1 To 10
If Not Me("chkSJABody" & counter).Value = False Then
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblSJABody WHERE SJA_Step = '" & Me("txtSJA_Step" & counter) & "'")
With rs
.Edit
.Fields("BasicStep") = Me("txtBasicStep" & counter).Value
.Fields("Hazard") = Me("txtHazard" & counter).Value
.Fields("Consequence") = Me("txtConsequence" & counter).Value
.Fields("Measures") = Me("txtMeasures" & counter).Value
.Fields("PersonMeasures") = Me("txtPersonMeasures" & counter).Value
.Update
End With
Set db = Nothing
Set rs = Nothing
End If
Next counter
MsgBox("SJA is now waiting for OIM's approval.", vbOKOnly, "SJA updated")
...
Can anyone explain why, and what should I do to be able to include the "AND" part?
Thanks,
Anders