Hi,
I have a search form with some combo boxes and textboxes. Whenever I finish a search, clear the combo box, textboxes by clicking the 'CLEAR' button, and do a search again, it always gives me the '2001' error message. However, if I don't touch the 'CLEAR' button and keep doing my search by 'backspacing' the text in the textbox or re-selecting a new item in the combo box, then it will work fine. I'm not sure if there's somthing wrong with my queries...or is the way I program my 'Clear' button wrong?
error 2001 happens when:
1) do the search
2) push the 'Clear' button
3) do another search
4) error pops up!
no error when:
1) do the search
2) 'backspace' the text in textboxes, re-selecting another item in the combo box
3) do another search
4) No error!
Thanks a lot for your help.
I have a search form with some combo boxes and textboxes. Whenever I finish a search, clear the combo box, textboxes by clicking the 'CLEAR' button, and do a search again, it always gives me the '2001' error message. However, if I don't touch the 'CLEAR' button and keep doing my search by 'backspacing' the text in the textbox or re-selecting a new item in the combo box, then it will work fine. I'm not sure if there's somthing wrong with my queries...or is the way I program my 'Clear' button wrong?
error 2001 happens when:
1) do the search
2) push the 'Clear' button
3) do another search
4) error pops up!
no error when:
1) do the search
2) 'backspace' the text in textboxes, re-selecting another item in the combo box
3) do another search
4) No error!
Thanks a lot for your help.
Code:
Private Sub Search_Click()
If docList.ListIndex = 0 Then
If Me.dateEntry.Value <> 0 And Me.clientList.Value <> "" Then
resultForm.Form.RecordSource = "qryAgreement_all"
Else
resultForm.Form.RecordSource = "qryAgreement"
End If
more......
Code:
Private Sub Clear_Click()
docList.Value = Null
refEntry.Value = ""
dateEntry.Value = ""
acctList.Value = Null
productList.Value = Null
clientList.Value = Null
materialList.Value = Null
bankList.Value = Null
dateEntry.Enabled = False
refEntry.Enabled = False
bankList.Enabled = False
acctList.Enabled = False
productList.Enabled = False
clientList.Enabled = False
materialList.Enabled = False
End Sub