I have fallen into a rut building a quote creation tool. I have a combo box that selects an item for the quote and will populate all of the fields for that line. In this case, I want the [Cost] field to be locked, preventing any changes. However, there are times when a user must type an item for the quote that is not in the combo box; therefore, all of the fields on that line will be null and must be typed manually.
I am trying to write a VBA event where [Cost] is locked when [Cost] is not null, preventing any change; and where [Cost] is not locked when [Cost] is Null, allowing editing.
Private Sub Form_Current() If IsNull(Me.Cost) = True Then Me.Cost.Locked = False Else Me.Cost.Locked = True End If End Sub
- The top line is in the combo box and the entire line is populated; Here I want cost to be locked
- The second line is not in the combo and the line must be manually entered; Here I want lock to be disabled
没有评论:
发表评论