Hi,
The following statement is placed in the init event of myform

thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
invoice.invdate ;
from pinvitem, pinvoice into table invallo where pinvoice.invdate = date() ;
and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
order by pinvitem.invnum, pinvitem.partno asc"

thisform.grid1.RowSourceType = 4

I got an error message : 'commands contains unrecognized pharse/keyword'

but I do the above 'select' statement alone , it has no error at all.
please give me a hand
thanks

Re: select statement problem by Rick

Rick
Thu Sep 16 07:40:49 CDT 2004

Eddy,
It's almost never a good idea to continue a string from line to line. =
Instead try:
thisform.grid1.RowSource =3D ;
+"select pinvitem.invnum, pinvitem.partno, invoice.invdate" ;
+" from pinvitem, pinvoice into table invallo where pinvoice.invdate =3D =
date()" ;
+" and pinvoice.invnum =3D pinvitem.invnum and pinvitem.recstat =3D 'P' =
";
+" order by pinvitem.invnum, pinvitem.partno asc"

Rick

"Eddy" <Eddy@discussions.microsoft.com> wrote in message =
news:5A85D705-7E71-4EDA-AE27-EF6CEE18AF0F@microsoft.com...
> Hi,=20
> The following statement is placed in the init event of myform
>=20
> thisform.grid1.RowSource =3D "select pinvitem.invnum, pinvitem.partno, =

> invoice.invdate ;
> from pinvitem, pinvoice into table invallo where pinvoice.invdate =3D =
date() ;
> and pinvoice.invnum =3D pinvitem.invnum and pinvitem.recstat =3D 'P' ;
> order by pinvitem.invnum, pinvitem.partno asc"
>=20
> thisform.grid1.RowSourceType =3D 4
>=20
> I got an error message : 'commands contains unrecognized =
pharse/keyword'
>=20
> but I do the above 'select' statement alone , it has no error at all.
> please give me a hand
> thanks

Re: select statement problem by George

George
Thu Sep 16 08:11:37 CDT 2004

better yet:

Text To sqlCommand NoShow
select pinvitem.invnum, pinvitem.partno, invoice.invdate
from pinvitem, pinvoice into table invallo
where pinvoice.invdate = date()
and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P'
order by pinvitem.invnum, pinvitem.partno asc
EndText

thisform.grid1.RowSource = sqlCommand

best practice?
Run the select first, then assign the cursor as rowsource

Another thing, you should Dodefault() in the init of the form in order
to create all the controls before doing things with them, and then do
your code.

Just in case, you never know

hth



Eddy wrote:

> Hi,
> The following statement is placed in the init event of myform
>
> thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
> invoice.invdate ;
> from pinvitem, pinvoice into table invallo where pinvoice.invdate = date() ;
> and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
> order by pinvitem.invnum, pinvitem.partno asc"
>
> thisform.grid1.RowSourceType = 4
>
> I got an error message : 'commands contains unrecognized pharse/keyword'
>
> but I do the above 'select' statement alone , it has no error at all.
> please give me a hand
> thanks

Re: select statement problem by Gene

Gene
Thu Sep 16 13:52:01 CDT 2004

"Eddy" <Eddy@discussions.microsoft.com> wrote:

>The following statement is placed in the init event of myform
>
>thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
>invoice.invdate ;
^^^^^^^
I think you mean "pinvoice".

>from pinvitem, pinvoice into table invallo where pinvoice.invdate = date() ;
> and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
> order by pinvitem.invnum, pinvitem.partno asc"
^^^
1) This is not needed since the default is ascending.
2) It only applies to pinvitem.partno. For example,
... order by pinvitem.invnum desc, pinvitem.partno asc
is valid.
3) I thought "asc" was an error, but it is not. "asce", oddly
enough, was (under VFP 6 but presumably other versions, too).

>thisform.grid1.RowSourceType = 4
>
>I got an error message : 'commands contains unrecognized pharse/keyword'
>
>but I do the above 'select' statement alone , it has no error at all.

Do you type it or cut and paste? The error I see is an easy typo
to make.

>please give me a hand
>thanks

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: select statement problem by Rick

Rick
Thu Sep 16 14:50:24 CDT 2004

George,
As long as you are working in VFP 7.0 and higher. Eddy didn't say what =
version was in use.

Rick

"George" <SpamMyAss@Mailinator.com> wrote in message =
news:%23qwT06%23mEHA.3968@TK2MSFTNGP11.phx.gbl...
> better yet:
>=20
> Text To sqlCommand NoShow
> select pinvitem.invnum, pinvitem.partno, invoice.invdate
> from pinvitem, pinvoice into table invallo
> where pinvoice.invdate =3D date()
> and pinvoice.invnum =3D pinvitem.invnum and pinvitem.recstat =
=3D 'P'
> order by pinvitem.invnum, pinvitem.partno asc
> EndText
>=20
> thisform.grid1.RowSource =3D sqlCommand
>=20
> best practice?
> Run the select first, then assign the cursor as rowsource
>=20
> Another thing, you should Dodefault() in the init of the form in order =

> to create all the controls before doing things with them, and then do=20
> your code.
>=20
> Just in case, you never know
>=20
> hth
>=20
>=20
>=20
> Eddy wrote:
>=20
>> Hi,=20
>> The following statement is placed in the init event of myform
>>=20
>> thisform.grid1.RowSource =3D "select pinvitem.invnum, =
pinvitem.partno,=20
>> invoice.invdate ;
>> from pinvitem, pinvoice into table invallo where pinvoice.invdate =3D =
date() ;
>> and pinvoice.invnum =3D pinvitem.invnum and pinvitem.recstat =3D 'P' =
;
>> order by pinvitem.invnum, pinvitem.partno asc"
>>=20
>> thisform.grid1.RowSourceType =3D 4
>>=20
>> I got an error message : 'commands contains unrecognized =
pharse/keyword'
>>=20
>> but I do the above 'select' statement alone , it has no error at all.
>> please give me a hand
>> thanks

RE: select statement problem by Eddy

Eddy
Fri Sep 17 01:59:02 CDT 2004

Thanks for all your help,
here some more details about my case.
I am using VFP6 SP4.
I put the statement
select pinvitem.invnum....... order by pinvitem.invnum , pinvitem.partno asc
in a test.prg, then
do test.prg. Result is
I can get a table 'invallo.dbf' and in the record order that I want.
but error occurs in the case as described below

Is this problem only appear in VFP6 ?


"Eddy" wrote:

> Hi,
> The following statement is placed in the init event of myform
>
> thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
> pinvoice.invdate ;
> from pinvitem, pinvoice into table invallo where pinvoice.invdate = date() ;
> and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
> order by pinvitem.invnum, pinvitem.partno asc"
>
> thisform.grid1.RowSourceType = 4
>
> I got an error message : 'commands contains unrecognized pharse/keyword'
>
> but I do the above 'select' statement alone , it has no error at all.
> please give me a hand
> thanks

Re: select statement problem by Bill

Bill
Wed Sep 22 18:22:07 CDT 2004

I suspect that your problem is in the 255 (?) character limit of the
compiler...your string is too long and is being cut off. Try this:

thisform.grid1.RowSource = ;
"select pinvitem.invnum, pinvitem.partno, pinvoice.invdate " ;
+ "from pinvitem, pinvoice "
+ "into table invallo "
+ "where pinvoice.invdate = date() " ;
+ "and pinvoice.invnum = pinvitem.invnum ";
+ "and pinvitem.recstat = 'P' " ;
+ "order by pinvitem.invnum, pinvitem.partno asc "

Note that when I have to do this, I leave a space before the end quotes so I
don't join two words together. And watch for embedded quotes...." 'P' ".

HTH's
--
Bill Browne
www.edgefinderstudios.com


"Eddy" <Eddy@discussions.microsoft.com> wrote in message
news:01722694-A25D-4F2E-A348-3FBF296C57F5@microsoft.com...
> Thanks for all your help,
> here some more details about my case.
> I am using VFP6 SP4.
> I put the statement
> select pinvitem.invnum....... order by pinvitem.invnum , pinvitem.partno
asc
> in a test.prg, then
> do test.prg. Result is
> I can get a table 'invallo.dbf' and in the record order that I want.
> but error occurs in the case as described below
>
> Is this problem only appear in VFP6 ?
>
>
> "Eddy" wrote:
>
> > Hi,
> > The following statement is placed in the init event of myform
> >
> > thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
> > pinvoice.invdate ;
> > from pinvitem, pinvoice into table invallo where pinvoice.invdate =
date() ;
> > and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
> > order by pinvitem.invnum, pinvitem.partno asc"
> >
> > thisform.grid1.RowSourceType = 4
> >
> > I got an error message : 'commands contains unrecognized pharse/keyword'
> >
> > but I do the above 'select' statement alone , it has no error at all.
> > please give me a hand
> > thanks



Re: select statement problem by Anders

Anders
Thu Sep 23 04:26:50 CDT 2004

Use the View Designer or the Query Designer to (CREATE VIEW | QUERY ) to
build your query. If it's a view you can drop the view into the form's
DataEnvironment and drag it from the there onto you form and done. Or place
a grid on the form and assign the view as Recordsource.
Learn to use query aliases
FROM Pinvitem P, Pinvoice I
then replace all reference to Pinvitem. with P. and reference to Pinvoice.
with I. That shortens the text, prevents spelling mistakes, and increases
readablility.
-Anders


"Eddy" <Eddy@discussions.microsoft.com> wrote in message
news:01722694-A25D-4F2E-A348-3FBF296C57F5@microsoft.com...
> Thanks for all your help,
> here some more details about my case.
> I am using VFP6 SP4.
> I put the statement
> select pinvitem.invnum....... order by pinvitem.invnum , pinvitem.partno
asc
> in a test.prg, then
> do test.prg. Result is
> I can get a table 'invallo.dbf' and in the record order that I want.
> but error occurs in the case as described below
>
> Is this problem only appear in VFP6 ?
>
>
> "Eddy" wrote:
>
> > Hi,
> > The following statement is placed in the init event of myform
> >
> > thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
> > pinvoice.invdate ;
> > from pinvitem, pinvoice into table invallo where pinvoice.invdate =
date() ;
> > and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
> > order by pinvitem.invnum, pinvitem.partno asc"
> >
> > thisform.grid1.RowSourceType = 4
> >
> > I got an error message : 'commands contains unrecognized pharse/keyword'
> >
> > but I do the above 'select' statement alone , it has no error at all.
> > please give me a hand
> > thanks


RE: select statement problem by GaryZ

GaryZ
Thu Sep 16 10:43:05 CDT 2004

Eddy,

Also, for Grid objects the property names are RecordSource and
RecordSourceType.

GaryZ.

"Eddy" wrote:

> Hi,
> The following statement is placed in the init event of myform
>
> thisform.grid1.RowSource = "select pinvitem.invnum, pinvitem.partno,
> invoice.invdate ;
> from pinvitem, pinvoice into table invallo where pinvoice.invdate = date() ;
> and pinvoice.invnum = pinvitem.invnum and pinvitem.recstat = 'P' ;
> order by pinvitem.invnum, pinvitem.partno asc"
>
> thisform.grid1.RowSourceType = 4
>
> I got an error message : 'commands contains unrecognized pharse/keyword'
>
> but I do the above 'select' statement alone , it has no error at all.
> please give me a hand
> thanks