Clearing a combobox selection not whole recordset

EternalMyrtle

I'm still alive
Local time
Yesterday, 17:06
Joined
May 10, 2013
Messages
533
I would like to be able to clear a combobox selection with code but nothing I have tried is working. I have searched for the answer and tried numerous suggestions and still nothing works. So I turn here...

Most recently I have tried this:

Code:
Me.cboCompanies.ListIndex = -1

To no avail. The selection still remains highlighted in the control after the code is executed. I want the control to be blank. Also the control goes from being a combo box to a text box until escape is pressed and it is cleared :confused:

I have also tried using a simple Undo and that is not working either.

Thank you for your help.
 
That was the first thing I tried :(

I also tried

Me.cboCompanies.Value=""
Me.cboCompanies=Null
Me.cboCompanies.Value=Null
IsNull (Me.cboCompanies)

It's such an annoying problem not mission critical but annoying!!
 
Hmmm, that is a bit bizarre. Is it bound or unbound?
 
It is bound and a lookup to a table. The bound column is the PK so it is a number. Could that be why??
 
I figured it out. It is happening because the recordsource is not a simple table but a query. The second table in the query is messing it up.

I need it to be a query to accomplish what I want it to do so I will have to think about this some more.

Thanks for your help!!
 
So after all that, it turned out that my yes/no message box was coded incorrectly. Had I given you all the code from the beginning, you probably would have found it.

Lesson learned!
 

Users who are viewing this thread

Back
Top Bottom