Empty combobox values when access form loads vba

svuyyuru

Registered User.
Local time
Today, 17:25
Joined
Feb 10, 2014
Messages
33
I want to empty the combobox every time when form loads. Using the below code
Private Sub Form_Load()
combo1.RowSource = ""
End Sub
But Combobax is not emptying.
 
You need the Me. in front of your control name. I usually do this:

Code:
Me.cboComboBoxName = Null
 
You should also be using the On_current if you want this to work when changing records. On_Load only works the very first time the form is loaded and the box will not be emptied when switching records
 
Is this a bound control or unbound?

Are you sure you are referring to your control name in your code and not the field name?

Also, I had this problem once and it was because of other code. Is this all of the code?
 
It is Unbound control.
Yes i'm referring control name.
My full code inside the onEnter event

Code:
Private Sub Combo1_Enter()
Me.Combo1.RowSourceType = "Table/Query"
Me.Combo1.RowSource = "Select F1 from Dropdownvalues " & _
"WHERE F1 <> 'FM'; "
End Sub
 

Users who are viewing this thread

Back
Top Bottom