Combo box requery

K

Kay

I have a form that uses a combo box to provide drop lists
of selection opions. The first cbo field provides the
criteria for the 2nd cbo field. Question: When adding new
records, the combo box fields do not clear after moving to
a new record. How can I keep this from happening?
 
K

Ken Snell

I assume that the combo boxes are unbound. You could set their values to
Null in the code that moves you to a new record; or, if you're using
navigation buttons, put this code in the form's OnCurrent event:

Private Sub Form_Current()
If Me.NewRecord = True Then
Me.cboBox1.Value = Null
Me.cboBox2.Value = Null
End If
End Sub

If you always want to clear the combo boxes when you move to a different
record, whether a new record or not, then just use this:

Private Sub Form_Current()
Me.cboBox1.Value = Null
Me.cboBox2.Value = Null
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top