Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter works in one sub-form, but not in another

Status
Not open for further replies.

RobotMush

Technical User
Aug 18, 2004
197
US
I have a sub-form with a combo box to filter selections that works very well. When I created another form with the need for the exact same filter process I did a cut/paste and adjusted the names to agree to the new form. However, when I run the filter in the new form I get the following message.

"The expression "After Update" you entered as the event property setting produced the following error: A Problem Occured While Microsfot Access Was Communicating With The OLE Server Or Active X Control.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
*There may have been an error evaluating the Function, Event or Macro

Below is the Working Filter Program and the Non-Working Filter Program.

(WORKING FILTER)

Private Sub combo24_AfterUpdate()
'Filter Data via Choice in Client-sfrm
Dim strDept As String
If IsNull(Combo24) Then
Me.FilterOn = False
Else
strDept = Me.Dept
Me.Filter = "Dept='" & Combo24 & "'"
Me.FilterOn = True
With Me.RecordsetClone
.FindFirst "Dept= '" & strDept & "'"
If Not .NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
End If
End With
End If
Combo24 = Null
End Sub

(NON-WORKING FILTER)

Private Sub DeptFltrSlct_AfterUpdate()

Dim strDept As String
If IsNull(DeptFltrSlct) Then
Me.FilterOn = False
Else
strDept = Me.Dept
Me.Filter = "Dept='" & DeptFltrSlct & "'"
Me.FilterOn = True
With Me.RecordsetClone
.FindFirst "Dept= '" & strDept & "'"
If Not .NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
End If
End With
End If
DeptFltrSlct = Null
End Sub

What am I missing here?

Thank you for all your help and suggestions.

RobotMush (Technical User) Self Taught
 
What happens if you click the ellipsis (...) in the AfterUpdate property cell of DeptFltrSlct ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If I understood your question...
"What happens if you click the ellipsis (...) in the AfterUpdate property cell of DeptFltrSlct ? "

What happens is it brings up the Filter Program that does not work.
When I did The Cut/Past I copied the working Filter Program (Combo24) to the (DeptFltrSlct) removing the
"Private Sub combo24_AfterUpdate()"
Since the
"Private Sub DeptFltrSlct_AfterUpdate()"
was already up. I also removed the Second End Sub

Thank you for your help and suggestions

Robot Mush (Technical User) Self Taught
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top