associates
IS-IT--Management
Hi,
I have a form that has a listbox and four comboboxes that allow users to perform filtering. And any changes to the value of comboboxes will change the data items listed in the listbox (like filtering). My question is this. I'd like to have a button called clear that is used to clear all the comboboxes values. In another word, i want to reset all the comboboxes to original state where no selection is made (all empty) and the listbox should list out all items, not specific records.
Here is my sample code. To make it short, i just show only 1 combobox.
Private Sub CB_JobRegister_AfterUpdate()
Me.TB_JobRegQuery = "*"
DoEvents
If Not IsNull(Me.CB_JobRegister) Then
If Me.CB_JobRegister <> "" Then
Me.TB_JobRegQuery = Me.CB_JobRegister
End If
End If
DoEvents
Me.Refresh
End Sub
Private Sub Form_Load()
Me.TB_JobRegQuery = "*"
End Sub
Private Sub CM_Clearbutton_Click()
Me.CB_JobRegister = ""
'Me.Requery
'Me.ListJob.requery
Call CB_JobRegister_AfterUpdate
'Me.Refresh
End Sub
I've tried many ways but none of them worked. What happens is when i press on the clear button, it clears all the combobox but the listbox, ListJob, is empty. I tried to requery it but didn't work. Any way to get the listbox showing all the records again after the clear button's clicked.
Thank you in advance and look forward to hearing from you
I have a form that has a listbox and four comboboxes that allow users to perform filtering. And any changes to the value of comboboxes will change the data items listed in the listbox (like filtering). My question is this. I'd like to have a button called clear that is used to clear all the comboboxes values. In another word, i want to reset all the comboboxes to original state where no selection is made (all empty) and the listbox should list out all items, not specific records.
Here is my sample code. To make it short, i just show only 1 combobox.
Private Sub CB_JobRegister_AfterUpdate()
Me.TB_JobRegQuery = "*"
DoEvents
If Not IsNull(Me.CB_JobRegister) Then
If Me.CB_JobRegister <> "" Then
Me.TB_JobRegQuery = Me.CB_JobRegister
End If
End If
DoEvents
Me.Refresh
End Sub
Private Sub Form_Load()
Me.TB_JobRegQuery = "*"
End Sub
Private Sub CM_Clearbutton_Click()
Me.CB_JobRegister = ""
'Me.Requery
'Me.ListJob.requery
Call CB_JobRegister_AfterUpdate
'Me.Refresh
End Sub
I've tried many ways but none of them worked. What happens is when i press on the clear button, it clears all the combobox but the listbox, ListJob, is empty. I tried to requery it but didn't work. Any way to get the listbox showing all the records again after the clear button's clicked.
Thank you in advance and look forward to hearing from you