G
Guest
I want to lock a particular (individual) cell in a subform in access.
I tried putting the following code under the fields on_enter event,
but this locks the field for every record:
If Me.UnitsOrdered <= 0 Then
MsgBox "Cannot edit - no units ordered!"
Me.UnitsReceived.Locked = True
End If
I have another proc that access the recordset of the subform to perform
other checks, but I cant figure out how to lock the individual field for a
particular record,
Do Until rs.EOF
tally = rs("UnitsReceived") + rs("UnitsUsed") + rs("UnitsDamaged")
If tally < rs("UnitsOrdered") Then
MsgBox "Incorrect Ammounts - Do Not Match Units Ordered!"
MsgBox rs("ProductName")
GoTo lastline
End If
If tally > rs("UnitsOrdered") Then
MsgBox "Incorrect Ammounts - Do Not Match Units Ordered!"
MsgBox rs("ProductID")
GoTo lastline
End If
rs.MoveNext
Loop
Thank you for any help offered!
I tried putting the following code under the fields on_enter event,
but this locks the field for every record:
If Me.UnitsOrdered <= 0 Then
MsgBox "Cannot edit - no units ordered!"
Me.UnitsReceived.Locked = True
End If
I have another proc that access the recordset of the subform to perform
other checks, but I cant figure out how to lock the individual field for a
particular record,
Do Until rs.EOF
tally = rs("UnitsReceived") + rs("UnitsUsed") + rs("UnitsDamaged")
If tally < rs("UnitsOrdered") Then
MsgBox "Incorrect Ammounts - Do Not Match Units Ordered!"
MsgBox rs("ProductName")
GoTo lastline
End If
If tally > rs("UnitsOrdered") Then
MsgBox "Incorrect Ammounts - Do Not Match Units Ordered!"
MsgBox rs("ProductID")
GoTo lastline
End If
rs.MoveNext
Loop
Thank you for any help offered!