I currently have a combo box that selects the employee to create a new holiday record. Once the user has finished adding the record I don't want to enable the field during the scrolling of the records. How can I do this?
Bob I'm not sure that mosh wanted to hide the Combobox, I think he just wanted to lock it to prevent it being changed once the user had added the record.
Perhaps the following would be more appropriate?
Code:
If IsNull(Me!YourFieldTheComboBoxIsBoundTo) Then
Me.YourComboBoxName.locked = False
Me.YourComboBoxName.enabled = True
Else
Me.YourComboBoxName.locked = True
Me.YourComboBoxName.enabled = False
End If
Bob I'm not sure that mosh wanted to hide the Combobox, I think he just wanted to lock it to prevent it being changed once the user had added the record.
Perhaps the following would be more appropriate?
Code:
If IsNull(Me!YourFieldTheComboBoxIsBoundTo) Then
Me.YourComboBoxName.locked = False
Me.YourComboBoxName.enabled = True
Else
Me.YourComboBoxName.locked = True
Me.YourComboBoxName.enabled = False
End If
Good point - I did miss that intent. However, you would want to EITHER lock or disable the combo, not both as it is not necessary. And just a as an FYI to mosh, if you disable it then it grays out but if you lock it, it keeps it's color but just can't be edited. How you do it all depends on how you want to display it.
Personally, I do both only because of UI; users get confused when they try to click on a locked control but understand why if it's greyed out. Several other windows application behave this, and I just can't see why Microsoft didn't make this a one step affair, considering how they wrote the UI guideline themselves...