Filtering based on a Text Box,

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
 
D

Dale Fye

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.
 
K

kharpe

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
 

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