Hi
I have the following code which give me an error. Any idea?
File test.prg
----------------
PARAMETERS cond as String
SELECT dp
? cond
browse FOR &cond

do test with "col1=9"

Error:
Command contains unrecognized phrase/Keyword
Thanks
Myalo

Re: How to use parameter or variable in a FOR clause by Rush

Rush
Sun Jul 20 12:05:45 CDT 2008

myalo wrote:
> Hi
> I have the following code which give me an error. Any idea?
> File test.prg
> ----------------
> PARAMETERS cond as String
> SELECT dp
> ? cond
> browse FOR &cond
>
> do test with "col1=9"
>
> Error:
> Command contains unrecognized phrase/Keyword
> Thanks
> Myalo

Works fine for me (VFP9, SP2). Have you over-simplified your sample
'cond' parameter?

- Rush

Re: How to use parameter or variable in a FOR clause by Zootal

Zootal
Sun Jul 20 14:36:02 CDT 2008


"Rush Strong" <rush.strong@[DELETEME]verizon.net> wrote in message
news:ufE%23bro6IHA.2220@TK2MSFTNGP06.phx.gbl...
> myalo wrote:
>> Hi
>> I have the following code which give me an error. Any idea?
>> File test.prg
>> ----------------
>> PARAMETERS cond as String
>> SELECT dp
>> ? cond
>> browse FOR &cond
>>
>> do test with "col1=9"
>>
>> Error:
>> Command contains unrecognized phrase/Keyword
>> Thanks
>> Myalo
>
> Works fine for me (VFP9, SP2). Have you over-simplified your sample
> 'cond' parameter?
>
> - Rush


Works for me to. Try this:


Browse for (cond)



Re: How to use parameter or variable in a FOR clause by Stefan

Stefan
Sun Jul 20 04:23:06 CDT 2008


"myalo" <myalog@gmail.com> wrote in message
news:dad6565c-1ff4-4b49-affc-14d680281385@x36g2000prg.googlegroups.com...
> Hi
> I have the following code which give me an error. Any idea?
> File test.prg
> ----------------
> PARAMETERS cond as String
> SELECT dp
> ? cond
> browse FOR &cond
>
> do test with "col1=9"
>
> Error:
> Command contains unrecognized phrase/Keyword

Hi Myalo -

This sequence works for me in the command window:
CREATE CURSOR dp (col1 Int)
cond = "col1=9"
BROWSE FOR &cond
INSERT INTO dp VALUES (3)
INSERT INTO dp VALUES (9)
BROWSE FOR &cond


FWIW, personally I'd prefer something like this though:
lnFilter = 9
Select * from dp Where col1 = ?m.lnFilter


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------


Re: How to use parameter or variable in a FOR clause by myalo

myalo
Sun Jul 20 16:15:42 CDT 2008

On Jul 20, 2:23=A0am, "Stefan Wuebbe" <stefan.wue...@gmx.de> wrote:
> "myalo" <mya...@gmail.com> wrote in message
>
> news:dad6565c-1ff4-4b49-affc-14d680281385@x36g2000prg.googlegroups.com...
>
> > Hi
> > I have the following code which give me an error. Any idea?
> > File test.prg
> > ----------------
> > PARAMETERS cond as String
> > SELECT dp
> > ? cond
> > browse FOR &cond
>
> > do test with "col1=3D9"
>
> > Error:
> > Command contains unrecognized phrase/Keyword
>
> Hi Myalo -
>
> This sequence works for me in the command window:
> =A0 =A0 CREATE CURSOR dp (col1 Int)
> =A0 =A0 cond =3D "col1=3D9"
> =A0 =A0 BROWSE FOR &cond
> =A0 =A0 INSERT INTO dp VALUES (3)
> =A0 =A0 INSERT INTO dp VALUES (9)
> =A0 =A0 BROWSE FOR &cond
>
> FWIW, personally I'd prefer something like this though:
> =A0 =A0 lnFilter =3D 9
> =A0 =A0 Select * from dp Where col1 =3D ?m.lnFilter
>
> hth
> -Stefan
>
> --
> =A0|\_/| ------ ProLib - programmers liberty -----------------
> =A0(.. ) Our MVPs and MCPs make the Fox run....
> =A0 - / =A0See us atwww.prolib.deorwww.AFPages.de
> =A0----------------------------------------------------------- =A0

thanks all. I did simplfy. I had a parameter name col1 and in the
table also col1 so the macro was refering to the value of col1 in the
table (my best guess). Changing params names fixed it.
maylo