Evaluating Strings in Query Builder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Assume that I have a textbox on a form with a value of "0,1,2"

In query builder, I want the criteria field to reference the textbox and
evaluate to In(0,1,2).

How should I write the expression such that it evaluates properly?

-Larry
 
?Your textbox holds the (literal) string "0,1,2"? Or holds a single value,
either 0 or 1 or 2?

The In(0,1,2) function checks to see if what you have is one of the
comma-delimited values.

What are you trying to do? What do you mean by "evaluate to ..."?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
You can't. The IN clause needs commas as part of it's syntax, and you have
them as part of, what would be, a single data element of the parameters.

So, if you were to write this value, it would parse like this:

WHERE fieldname IN ( "0,1,2" ) instead of

WHERE fieldname IN ( "0","1","2" )


--
Steve Clark, Access MVP
FMS, Inc
http://www.fmsinc.com/consulting
Professional Access Database Repair
*FREE* Access Tips: http://www.fmsinc.com/free/tips.html
 
Thanks for the reply. I did understand why it was choking for me. I was
just hoping that there might be a technique where it would parse into:

WHERE fieldname IN ( 0,1,2) (no quotes whatsoever)
 
Slow and not efficient but you could try the following

WHERE Instr(1,[Forms]![FormName]![ControlName] & ",",[FieldName])>0
 
Back
Top