Programatically deselect a combobox?

ogg13

Registered User.
Local time
Yesterday, 18:00
Joined
Jan 30, 2007
Messages
49
Lets say a user clicks an item in a combo box, and then does whatever it is that they need to do with the selected item. Now, theres another combobox that the user needs to work with.

Is there any way that I can programatically revert the first combobox back to default state? Im basically looking for a way to remove the black highlighted bar on the first combo box so that the user cannot confuse which combo box he is working with. I know when and where to place code to do this, but not how its done. If anyone has any ideas, please let me know. Thank you!
 
Try

Me.ComboName = Null

or

Me.ComboName = ""
 
try:
Me.Combo1.SetFocus
Me.Combo1.Text = Me.Combo1.ItemData(0) 'this will reset to the first item in the
' combo. change the number to select lower in the list
 
or better yet, if youve set the default in the forms properties
Me.Combo3.SetFocus
Me.Combo3.Text = Me.Combo3.DefaultValue
 
dreamy, In Access the default property of a control is the .Value property unlike VB where it is the .Text property. The .Text property in Access requires that the control have the focus whereas the .value property does not. Unless you have a specific reason for accessing the .Text property such as capturing keystrokes in the Change event, stick with the .Value property.

Me.Combo3 = Me.Combo3.DefaultValue --- you have no need to move focus to the control.
Or if you prefer
Me.Combo3.Value = Me.Combo3.DefaultValue
 
eek

sorry, ive got 5 projects going right now. three in vb.net and two in access. i guess im getting old :0)
...dreamy... lol
 

Users who are viewing this thread

Back
Top Bottom