kerrance76
Registered User.
- Local time
- Today, 10:55
- Joined
- Mar 27, 2007
- Messages
- 16
Hi
I have an access application with a linked excel file, there are to many fields to build a form in access so i am trying to implement a few custom search boxes using combo boxes, the code i am using is
The problem i am having is that i get error 1004 autofilter range error
If i put a breakpoint in everything works ok until i get to the autofilter line, the form is filtered ok but the code then goes back to the top and runs again, the second time i get to the autofilter line the error occurs.
Can anybody explain why the code runs twice and how to stop it or how to re write this, many thanks.
Spreadsheet attached
I have an access application with a linked excel file, there are to many fields to build a form in access so i am trying to implement a few custom search boxes using combo boxes, the code i am using is
Code:
Private Sub cboJobNumberSearch_Change()
Txt = cboJobNumberSearch
If Not Txt = "Job Number" Then
filterform
Else
Me.AutoFilterMode = False
End If
End Sub
Private Sub cmdClear_Click()
cboJobNumberSearch = "Job Number"
End Sub
Public Sub filterform()
Worksheets("Sheet1").Range("A1").AutoFilter field:=1, Criteria1:=Txt
End Sub
The problem i am having is that i get error 1004 autofilter range error
If i put a breakpoint in everything works ok until i get to the autofilter line, the form is filtered ok but the code then goes back to the top and runs again, the second time i get to the autofilter line the error occurs.
Can anybody explain why the code runs twice and how to stop it or how to re write this, many thanks.
Spreadsheet attached