Need help filtering on multiple combo boxes


G

Guest

Hi All,

I have constructed the following code based on some examples that I have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object" and the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like *"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] " &
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "' AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
Ad

Advertisements

G

Graham Mandeno

Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example, right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven "Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" & cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Emma said:
Hi All,

I have constructed the following code based on some examples that I have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object" and the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like *"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] " &
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "' AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
G

Guest

Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code you
provided. However, I am now getting an error "You cancelled the previous
operation. Why is that?


Graham Mandeno said:
Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example, right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven "Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" & cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Emma said:
Hi All,

I have constructed the following code based on some examples that I have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object" and the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like *"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] " &
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "' AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
G

Graham Mandeno

On which line?

--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code you
provided. However, I am now getting an error "You cancelled the previous
operation. Why is that?


Graham Mandeno said:
Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example, right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven "Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire
filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" & cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Emma said:
Hi All,

I have constructed the following code based on some examples that I
have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object" and
the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like *"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] " &
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "'
AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
G

Guest

Sorry I was out yesterday with a sick child.

Anyway, I get the error on the line:

Me.FilterOn = True

Thanks!

Graham Mandeno said:
On which line?

--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code you
provided. However, I am now getting an error "You cancelled the previous
operation. Why is that?


Graham Mandeno said:
Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example, right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven "Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire
filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" & cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Hi All,

I have constructed the following code based on some examples that I
have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object" and
the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like *"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] " &
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "'
AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
G

Graham Mandeno

Hi Emma

I hope your child is better today :)

The "Cancelled previous operation" error can often be misleading.

The most obvious question to ask is: "Is there an operation being
cancelled?"

This most likely be a BeforeUpdate event being cancelled.

Try adding the following to your BuildFilter code, just before "Me.Filter ="

Debug.Print "Dirty:", Me.Dirty
Debug.Print "Filter:", Me.Filter
Debug.Print "FilterOn:", Me.FilterOn
Debug.Print "strFilter:", strFilter
Stop

Then copy the four results from immediate window and post them back here in
a reply.
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Sorry I was out yesterday with a sick child.

Anyway, I get the error on the line:

Me.FilterOn = True

Thanks!

Graham Mandeno said:
On which line?

--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code you
provided. However, I am now getting an error "You cancelled the
previous
operation. Why is that?


:

Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example,
right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven
"Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire
filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" &
cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their
AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Hi All,

I have constructed the following code based on some examples that I
have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object"
and
the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like
*"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] "
&
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "'
AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
Ad

Advertisements

G

Guest

Here are the results from the immediate window:

Dirty: False
Filter: [Cnt_Spec]='src' AND [Action]=''
FilterOn: True
strFilter: [Cnt_Spec]='src' AND [Action]='' AND

Also, I did notice that for some reason even though I am not entering any
data in the "Action" field, the code is still using [Action] to filter on.
It should be "Null". One more thing, cbo_cnt_spec and cbo_actn come from
lookup fields do I need change that?

Forever grateful!

--
www.bardpv.com
Tempe, Arizona


Graham Mandeno said:
Hi Emma

I hope your child is better today :)

The "Cancelled previous operation" error can often be misleading.

The most obvious question to ask is: "Is there an operation being
cancelled?"

This most likely be a BeforeUpdate event being cancelled.

Try adding the following to your BuildFilter code, just before "Me.Filter ="

Debug.Print "Dirty:", Me.Dirty
Debug.Print "Filter:", Me.Filter
Debug.Print "FilterOn:", Me.FilterOn
Debug.Print "strFilter:", strFilter
Stop

Then copy the four results from immediate window and post them back here in
a reply.
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Sorry I was out yesterday with a sick child.

Anyway, I get the error on the line:

Me.FilterOn = True

Thanks!

Graham Mandeno said:
On which line?

--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code you
provided. However, I am now getting an error "You cancelled the
previous
operation. Why is that?


:

Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example,
right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven
"Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire
filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" &
cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their
AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Hi All,

I have constructed the following code based on some examples that I
have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object"
and
the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like
*"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] "
&
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "'
AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
G

Guest

In Addition, I've revised the code slightly to accomodate some numeric
fields. Here is the new code.

Private Function BuildFilter()

Const cAND As String = " AND "
Dim strFilter As String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & [cbo_Cnt_Spec].Column(1) & "'"
& cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]=" & [cbo_Terr] & cAND
End If

If Not IsNull(cbo_account_No) Then
strFilter = strFilter & "[Acct_Num]=" & [cbo_account_No] & cAND
End If

If Not IsNull(cbo_Acct_Name) Then
strFilter = strFilter & "[Acct_Name]='" & [cbo_Acct_Name] & "'" & cAND
End If

If Not IsNull(cbo_contract_No) Then
strFilter = strFilter & "[Contract_No]='" & [cbo_contract_No] & "'" & cAND
End If

If Not IsNull(cbo_Month_Year) Then
strFilter = strFilter & "[Month/Year]='" & [cbo_Month_Year] & "'" & cAND
End If

If Not IsNull(cbo_actn_no) Then
strFilter = strFilter & "[Action]='" & [cbo_Action].Column(1) & "'" & cAND
End If

If Len(strFilter) = 0 Then

Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
End If

End Function

--
www.bardpv.com
Tempe, Arizona


Graham Mandeno said:
Hi Emma

I hope your child is better today :)

The "Cancelled previous operation" error can often be misleading.

The most obvious question to ask is: "Is there an operation being
cancelled?"

This most likely be a BeforeUpdate event being cancelled.

Try adding the following to your BuildFilter code, just before "Me.Filter ="

Debug.Print "Dirty:", Me.Dirty
Debug.Print "Filter:", Me.Filter
Debug.Print "FilterOn:", Me.FilterOn
Debug.Print "strFilter:", strFilter
Stop

Then copy the four results from immediate window and post them back here in
a reply.
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Sorry I was out yesterday with a sick child.

Anyway, I get the error on the line:

Me.FilterOn = True

Thanks!

Graham Mandeno said:
On which line?

--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code you
provided. However, I am now getting an error "You cancelled the
previous
operation. Why is that?


:

Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example,
right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven
"Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire
filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" & cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" &
cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is call
BuildFilter, so delete their event procs and change all their
AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Hi All,

I have constructed the following code based on some examples that I
have
seen on several threads. However, I am problems running the code.

I keep getting the error "You can't assign a value to this object"
and
the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter = "Like
*"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like *"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like *"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like *"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND [Terr] "
&
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter & "'
AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 
Ad

Advertisements

G

Graham Mandeno

Hi Emma

Sorry - got called out to do some real work :)

It appears the "Cancelled previous operation" error is indeed being
misleading and probably arises from an invalid filter string.

Let's look first at the "lookup" fields. These are nasty, confusing, and
generally considered to be the Work of the Devil <g>

When you see a lookup field in a table, it generally displays some text,
which is not actually there at all. In fact it is the value in a field in
another table which is related to the field in question.

Probably, your Action and Cnt_Spec are numeric, and their related "lookup"
tables have a numeric primary key and a text description field. Is this
correct?

Your combo boxes should then be like this:

RowSource: Select [PK field], [description field] from [lookup table]
order by [description field];
Column count: 2
Bound column: 1
Column widths: 0

That way, you get to *see* the text in the combo box, but its *value* is the
numeric PK.

So, for example, for cbo_Cnt_Spec, your code should be:

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]=" & [cbo_Cnt_Spec] & cAND
End If

Note that this is a *numeric* field, so no need for the quotes.

Try this again and report back what your filter string looks like.

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma Aumack said:
In Addition, I've revised the code slightly to accomodate some numeric
fields. Here is the new code.

Private Function BuildFilter()

Const cAND As String = " AND "
Dim strFilter As String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & [cbo_Cnt_Spec].Column(1) & "'"
& cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]=" & [cbo_Terr] & cAND
End If

If Not IsNull(cbo_account_No) Then
strFilter = strFilter & "[Acct_Num]=" & [cbo_account_No] & cAND
End If

If Not IsNull(cbo_Acct_Name) Then
strFilter = strFilter & "[Acct_Name]='" & [cbo_Acct_Name] & "'" & cAND
End If

If Not IsNull(cbo_contract_No) Then
strFilter = strFilter & "[Contract_No]='" & [cbo_contract_No] & "'" &
cAND
End If

If Not IsNull(cbo_Month_Year) Then
strFilter = strFilter & "[Month/Year]='" & [cbo_Month_Year] & "'" &
cAND
End If

If Not IsNull(cbo_actn_no) Then
strFilter = strFilter & "[Action]='" & [cbo_Action].Column(1) & "'" &
cAND
End If

If Len(strFilter) = 0 Then

Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
End If

End Function

--
www.bardpv.com
Tempe, Arizona


Graham Mandeno said:
Hi Emma

I hope your child is better today :)

The "Cancelled previous operation" error can often be misleading.

The most obvious question to ask is: "Is there an operation being
cancelled?"

This most likely be a BeforeUpdate event being cancelled.

Try adding the following to your BuildFilter code, just before "Me.Filter
="

Debug.Print "Dirty:", Me.Dirty
Debug.Print "Filter:", Me.Filter
Debug.Print "FilterOn:", Me.FilterOn
Debug.Print "strFilter:", strFilter
Stop

Then copy the four results from immediate window and post them back here
in
a reply.
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Emma said:
Sorry I was out yesterday with a sick child.

Anyway, I get the error on the line:

Me.FilterOn = True

Thanks!

:

On which line?

--
Graham Mandeno [Access MVP]
Auckland, New Zealand

Thank you Graham,

I revised my BuildFilter function to reflect the much cleaner code
you
provided. However, I am now getting an error "You cancelled the
previous
operation. Why is that?


:

Hi Emma

I need to ask the obvious questions:
1. Is AllowFilters set to Yes?
2. Can you apply a filter by any other means - for example,
right-click a
field and choose "Filter by selection"?

You might like to consider revising your code. Having up to seven
"Like
'*'" terms in your filter will be very inefficient.

[Hey - I just noticed - your wildcards are not in quotes.
Does it work if you change "Like *" to "Like '*'" ??
Also, you are missing an opening single-quote in
cbo_Terr_AfterUpdate]

I suggest you ditch the module-level variables and build the entire
filter
string in your BuildFilter function, only adding elements if the
corresponding control is not null:

Private Function BuildFilter()
Const cAND as String = " AND "
Dim strFilter as String

If Not IsNull(cbo_Cnt_Spec) Then
strFilter = strFilter & "[Cnt_Spec]='" & cbo_Cnt_Spec & "'" &
cAND
End If

If Not IsNull(cbo_Terr) Then
strFilter = strFilter & "[Terr]='" & cbo_Terr & "'" & cAND
End If

If Not IsNull(cbo_Account_No) Then
strFilter = strFilter & "[Acct_Num]='" & cbo_Account_No & "'" &
cAND
End If

' etc for other 4 controls...

If Len(strFilter) = 0 Then
Me.FilterOn = False
Else
' remove the last " AND "
Me.Filter = Left(strFilter, Len(strFilter) - Len(cAND))
Me.FilterOn = True
' no need to requery
End If

End Function

Now, all the AfterUpdate events for your combo boxes need do is
call
BuildFilter, so delete their event procs and change all their
AfterUpdate
properties from:
[Event Procedure]
to
=BuildFilter()
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Hi All,

I have constructed the following code based on some examples that
I
have
seen on several threads. However, I am problems running the
code.

I keep getting the error "You can't assign a value to this
object"
and
the
debugger highlights the line

Me.Filter = mstrFormFilter

Can anyone tell me why I am getting the error?

Here's the whole thing:

Dim mstrSpecFilter As String
Dim mstrCnt_NumFilter As String
Dim mstrAcct_NmFilter As String
Dim mstrAcct_NumFilter As String
Dim mstrExp_Mo_YrFilter As String
Dim mstrTerrFilter As String
Dim mstrFormFilter As String
Dim mstrActnFilter As String

Private Function BuildFilter() As Variant

If Len(mstrExp_Mo_YrFilter) = 0 Then mstrExp_Mo_YrFilter =
"Like
*"
If Len(mstrSpecFilter) = 0 Then mstrSpecFilter = "Like *"
If Len(mstrTerrFilter) = 0 Then mstrTerrFilter = "Like *"
If Len(mstrAcct_NmFilter) = 0 Then mstrAcct_NmFilter = "Like
*"
If Len(mstrAcct_NumFilter) = 0 Then mstrAcct_NumFilter = "Like
*"
If Len(mstrCnt_NumFilter) = 0 Then mstrCnt_NumFilter = "Like
*"
If Len(mstrActnFilter) = 0 Then mstrActnFilter = "Like*"

mstrFormFilter = "[Cnt_Spec] " & mstrSpecFilter & "' AND
[Terr] "
&
mstrTerrFilter & "' AND [Acct_Name] & mstrAcct_NmFilter & " ' AND
[Account_No] " & mstrAcct_NumFilter & "' AND [Month/Year] " &
mstrExp_Mo_YrFilter & '" AND [Contract_No]" & mstrCnt_NumFilter &
"'
AND
[Action]" & mstrActnFilter & "'"

Me.Filter = mstrFormFilter
Me.FilterOn = True
Me.Requery

End Function

Private Sub cbo_Month_Year_AfterUpdate()

mstrExp_Mo_YrFilter = "='" & cbo_Month_Year & "'"

Call BuildFilter

End Sub
Private Sub cbo_Cnt_Spec_AfterUpdate()

mstrSpecFilter = "='" & cbo_Cnt_Spec & "'"

Call BuildFilter

End Sub
Private Sub cbo_Terr_AfterUpdate()

mstrTerrFilter = "=" & cbo_Terr & "'"

Call BuildFilter

End Sub
Private Sub cbo_Account_No_AfterUpdate()

mstrAcct_NumFilter = "='" & cbo_account_No & "'"

Call BuildFilter

End Sub

Private Sub cbo_Action_AfterUpdate()

mstrActnFilter = "='" & cbo_Action & "'"

Call BuildFilter

End Sub



Private Sub cbo_Contract_No_AfterUpdate()

mstrCnt_NumFilter = "='" & cbo_contract_No & "'"

Call BuildFilter

End Sub




Private Sub cob_Acct_Name_AfterUpdate()


mstrAcct_NmFilter = "='" & cbo_Acct_Name & "'"

Call BuildFilter

End Sub


Thank you,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top