Me.Filter using wildcard in formula

L

larochy

Hi,

I have a situation where I'm trying to filter on some records within a
subform and I can't get it to work using a wildcard in the formula. I don't
get an error message, it just doesn't function properly.

We have five different Recognition Transaction Types that begin with
"Unbilled" and I want to see all five transaction types when I choose
"Unbilled" from a Value List. Here's the code:

Private Sub Combo21_AfterUpdate()
If IsNull(Me.Combo21) Then
Me.FilterOn = False
ElseIf Me.Combo21 = "Show All" Then
Me.FilterOn = False
Else
Me.Filter = "RecognitionTransactionType = '" & Me.Combo21 & "*"
& "'"
Me.FilterOn = True

End If
End Sub

Here are the five Recognition Transaction Types that begin with "Unbilled".

Unbilled Hours - Overbudget
Unbilled Hours - Pending
Unbilled Hours - Percent Complete
Unbilled Hours - Ratable
Unbilled Hours - Unassigned

Any help with how to work the wildcard into the formula would be much
appreciated.
 
F

fredg

Hi,

I have a situation where I'm trying to filter on some records within a
subform and I can't get it to work using a wildcard in the formula. I don't
get an error message, it just doesn't function properly.

We have five different Recognition Transaction Types that begin with
"Unbilled" and I want to see all five transaction types when I choose
"Unbilled" from a Value List. Here's the code:

Private Sub Combo21_AfterUpdate()
If IsNull(Me.Combo21) Then
Me.FilterOn = False
ElseIf Me.Combo21 = "Show All" Then
Me.FilterOn = False
Else
Me.Filter = "RecognitionTransactionType = '" & Me.Combo21 & "*"
& "'"
Me.FilterOn = True

End If
End Sub

Here are the five Recognition Transaction Types that begin with "Unbilled".

Unbilled Hours - Overbudget
Unbilled Hours - Pending
Unbilled Hours - Percent Complete
Unbilled Hours - Ratable
Unbilled Hours - Unassigned

Any help with how to work the wildcard into the formula would be much
appreciated.
..
If you use wildcards you must use the Like keyword (not =)

Me.Filter = "RecognitionTransactionType Like '" & Me.Combo21 & "*'"

For clarity, the single and double quotes are:

Like ' " & Me.Combo21 & " * ' "
 
L

larochy

Thank you!

fredg said:
..
If you use wildcards you must use the Like keyword (not =)

Me.Filter = "RecognitionTransactionType Like '" & Me.Combo21 & "*'"

For clarity, the single and double quotes are:

Like ' " & Me.Combo21 & " * ' "
 

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