In the FormHeader section of a form, I have 8 unbound comboboxes that are used to filter the form's underlying recordsource upon clicking a button (I dynamically build an underlying SQL statement and apply it to the recordsource of the form). This works fine.
I also have a "Clear" button which is supposed to clear all of the comboboxes of previous values so that the user can enter new values for another filter. I use a For...Next loop to accomplish this as such:
For Each ctl In Me.FormHeader.Controls
If ctl.ControlType = acComboBox Then
ctl.Value = Null
End If
Next
Me.Repaint
This works 90% of the time. The other 10% is a mystery. It seems to not work when a user puts in a filter combination and no records are returned...which I trap with a message. When I step through the code, the process works fine; however, at run-time it doesn't behave as it should.
I've experimented with turning Echo on and off, setting ctl.Text = "", repainting within the For...Next loop, running the loop twice, hardcoding each control name in the procedure without a loop, etc. and I'm stumped.
It almost seems like something is stuck in the buffer somewhere and it won't get released via code.
Any suggestions would be greatly appreciated. Thanks!
I also have a "Clear" button which is supposed to clear all of the comboboxes of previous values so that the user can enter new values for another filter. I use a For...Next loop to accomplish this as such:
For Each ctl In Me.FormHeader.Controls
If ctl.ControlType = acComboBox Then
ctl.Value = Null
End If
Next
Me.Repaint
This works 90% of the time. The other 10% is a mystery. It seems to not work when a user puts in a filter combination and no records are returned...which I trap with a message. When I step through the code, the process works fine; however, at run-time it doesn't behave as it should.
I've experimented with turning Echo on and off, setting ctl.Text = "", repainting within the For...Next loop, running the loop twice, hardcoding each control name in the procedure without a loop, etc. and I'm stumped.
It almost seems like something is stuck in the buffer somewhere and it won't get released via code.
Any suggestions would be greatly appreciated. Thanks!