Filtering based on a Text Box,

  • Thread starter Thread starter kharpe
  • Start date Start date
K

kharpe

I have the following code for a filter based on an unbounded text box.

If Not IsNull(Me.DescriptionFilter) Then
stText = Me![DescriptionFilter]
StCriteria = "FCSI_Description Like *" & stText & "*"
'Sets the filter fot the priority selected on form
'If priority is not set, no criteria is enforced
End If

The text box is named DescriptionFilter. My theory is that the user can type
in a word or phrase and filter for all records with that text in the feild
FCSI_Description. When I run the filter I am getting the following
message"Syntax error (missing operator) in query expression 'FCSI_Description
Like *hull*'

It is probably something simple that I am missing, but was wondering if
anyone can see what I have missed in my Syntax
 
stCriteria needs to be interpretted to look like:

[FCSI_Description] like '*word*'

With quotes (in this case single) preceeding the first * and following the
second. Try:

StCriteria = "[FCSI_Description] Like '*" & stText & "*'"

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
Thanks, that did it.

Dale Fye said:
stCriteria needs to be interpretted to look like:

[FCSI_Description] like '*word*'

With quotes (in this case single) preceeding the first * and following the
second. Try:

StCriteria = "[FCSI_Description] Like '*" & stText & "*'"

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



kharpe said:
I have the following code for a filter based on an unbounded text box.

If Not IsNull(Me.DescriptionFilter) Then
stText = Me![DescriptionFilter]
StCriteria = "FCSI_Description Like *" & stText & "*"
'Sets the filter fot the priority selected on form
'If priority is not set, no criteria is enforced
End If

The text box is named DescriptionFilter. My theory is that the user can type
in a word or phrase and filter for all records with that text in the feild
FCSI_Description. When I run the filter I am getting the following
message"Syntax error (missing operator) in query expression 'FCSI_Description
Like *hull*'

It is probably something simple that I am missing, but was wondering if
anyone can see what I have missed in my Syntax
 
Back
Top