Only Enable combo box when adding Record

mosh

Registered User.
Local time
Today, 06:51
Joined
Aug 22, 2005
Messages
133
Hello All,

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?

Thanks.

m
________
Live sex
 
Last edited:
In the On Current event you can put:
Code:
If IsNull(Me!YourFieldTheComboBoxIsBoundTo) Then
    Me.YourComboBoxName.Visible = True
Else
    Me.YourComboBoxName.Visible = 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
 
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.
 
True it is not strictly necessary to both lock and disable, but the combination prevents the cursor from entering the control without greying it out.
 
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...
 

Users who are viewing this thread

Back
Top Bottom