I have a form that has a field that is a drop down with 5 values in it. Is
it possible to lock the field from update if they select one of the values,
but leave it open for update if they select the other 4?
Ex:
Values: Plan, Hold, Request, In process, Cancel
If Request is selected I do not want the users to be able to change the
status, but if they select Plan - then it is ok to have the user change the
status
Al Campagna - 14 Jun 2007 15:17 GMT
Patricia,
Use the AfterUpdate event of the combo to lock the field.
Private Sub YourComboName_AfterUpdate()
If YourComboName = "Request" Then
YourComboName.Locked = True
YourComboName.Enabled = False
Else
YourComboName.Locked = False
YourComboName.Enabled = True
End If
You'll also have to place this same code on the OnCurrent event of the
form itself... so that whenever you browse to a "Request" record, the field
will be Locked.
------
HTH
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love, and you'll never work a day in your life."
>I have a form that has a field that is a drop down with 5 values in it. Is
> it possible to lock the field from update if they select one of the
[quoted text clipped - 7 lines]
> the
> status
Sprinks - 14 Jun 2007 15:21 GMT
Patricia,
In the AfterUpdate event of the combo box and the form's OnCurrent event:
If Me![YourComboBox] = "Request" Then
Me![YourComboBox].Locked = True
End If
Note that, depending on your RowSource and ColumnWidths properties, the
combo box may *display* something different from its value. If you're unsure
what the value is corresponding to "Request", insert a temporary MsgBox
statement in the procedure:
MsgBox Me![YourComboBox]
then edit the If statement as required.
Sprinks
> I have a form that has a field that is a drop down with 5 values in it. Is
> it possible to lock the field from update if they select one of the values,
[quoted text clipped - 5 lines]
> status, but if they select Plan - then it is ok to have the user change the
> status