How are pipes (|) used in JET query expressions and how do I get a jet
query to treat it like normal text?? I know that you have to trap out
single ticks (') by doubling them up - how do you handle pipes? Are there
any other special characters that you have to watch out for when passing
them through the JET engine as part of a query?
Thanks in advance,
T.
---------------------------------------------
* Terry Myers - Senior Systems Engineer *
* Halo Technologies *
* OKC - 405.330.2400 Tulsa - 918.585.2207 *
* tdm...@halocorp.com or tdm...@ionet.net *
---------------------------------------------
> '|' in sql query gives - Error 3075 - 'Invalid use of vertical bars...'
> How are pipes (|) used in JET query expressions and how do I get a jet
> query to treat it like normal text?? I know that you have to trap out
> single ticks (') by doubling them up - how do you handle pipes? Are there
> any other special characters that you have to watch out for when passing
> them through the JET engine as part of a query?
> Thanks in advance,
> T.
A quick test gives me the same error. I get a different error if I double
up the bars, and an unset parameter error if I have two bars with any text
between them. The only thing that worked for me was if I created a
parameterized QueryDef and passed the string containing the bars to the
parameter, like so:
Query [this sucks]:
PARAMETERS meef Text;
SELECT DISTINCTROW templates.*
FROM Templates
WHERE descr = [meef];
Sub F___YouVeryMuchMicrosoft (DB As Database)
Dim QD As QueryDef: Set QD = DB.OpenQueryDef("this sucks")
QD!meef = "|what a load of crap|"
Dim SS As Snapshot: Set SS = QD.CreateSnapshot()
While (SS.EOF = False)
Debug.Print SS!Descr
SS.MoveNext
Wend
SS.Close : Set SS = Nothing
QD.Close : Set QD = Nothing
End Sub
Why, Microsoft, WHY??????? It would be one thing if we could at escape the
vertical bars like we can single and double-quotes, but this...!
--
Joe Foster (j...@bftsi0.gate.net or jfo...@gate.net)
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!
> Why, Microsoft, WHY??????? It would be one thing if we could at escape the
> vertical bars like we can single and double-quotes, but this...!
Sorry to follow up on my own post, but it gets even worse! I even got
errors when I tried to get around the problem using LIKE:
Set x = DB.CreateSnapshot("select * from templates where descr like '[|]nothing works[|]';")
Well, this might explain some weird errors I've heard about, perhaps caused
by users entering a vertical bar into a search string box by accident. OK,
who can I complain to at Microsoft without getting hit with an incident fee?
This is definitely a bug!
"[CategoryID] = ' " & Forms![Products]![CategoryID] & " ' "
Existing Microsoft Access applications may use the vertical bar operators
(| |) in place of an opening and closing combination of double quotation
marks (") and & (concatenation) operators, as follows:
"[CategoryID] = '|Forms![Products]![CategoryID]|' "
However, the use of vertical bars is not recommended because they can
produce unexpected results in some circumstances.
-------------
Huh?!? I would say unexpected results in some circumstances...
T.
---------------------------------------------
* Terry Myers - Senior Systems Engineer *
* Halo Technologies *
* OKC - 405.330.2400 Tulsa - 918.585.2207 *
* tdm...@halocorp.com or tdm...@ionet.net *
---------------------------------------------
> > Why, Microsoft, WHY??????? It would be one thing if we could at escape
> the
> > vertical bars like we can single and double-quotes, but this...!
>