Dear sirs
I'm trying to make an alias t my fields but these aliases have spaces as
follows

SELECT DEPTID as "dept id" , DEPTNAME as "dept name" FROM DEPTS INTO CURSOR
slctCurs

it gives me a syntax error
how can I fix that??

thanks
Mohammed

Re: field alias by Fred

Fred
Thu Dec 02 09:17:49 CST 2004

Spaces are not allowed in field names in VFP. Put an "_" where you have the
space.

--
Fred
Microsoft Visual FoxPro MVP


"Mohammed Abdel-Razzak" <MohammedAbdelRazzak@discussions.microsoft.com>
wrote in message news:730BD4D8-5433-431E-8A86-8DBFC837671C@microsoft.com...
> Dear sirs
> I'm trying to make an alias t my fields but these aliases have spaces as
> follows
>
> SELECT DEPTID as "dept id" , DEPTNAME as "dept name" FROM DEPTS INTO
> CURSOR
> slctCurs
>
> it gives me a syntax error
> how can I fix that??
>
> thanks
> Mohammed



Re: field alias by Eric

Eric
Thu Dec 02 09:24:26 CST 2004

Hello, Mohammed!
You wrote on Thu, 2 Dec 2004 06:43:01 -0800:

MAR> SELECT DEPTID as "dept id" , DEPTNAME as "dept name" FROM DEPTS INTO
MAR> CURSOR slctCurs

MAR> it gives me a syntax error
MAR> how can I fix that??

You can't have spaces in field names.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: field alias by Andrew

Andrew
Thu Dec 02 09:38:41 CST 2004

Mohammed Abdel-Razzak wrote:
> Dear sirs
> I'm trying to make an alias t my fields but these aliases have spaces
> as follows
>
> SELECT DEPTID as "dept id" , DEPTNAME as "dept name" FROM DEPTS INTO
> CURSOR slctCurs

Field names cannot have spaces. Use an underscore "_" if you really want a
visual separator.

You can, however, do this:

SELECT deptid, deptname ;
FROM depts ;
INTO CURSOR slctCurs

BROWSE FIELDS ;
deptid :h="Dept ID", ;
deptname :h="Dept Name"

--
HTH
Andrew Howell



RE: field alias by Mark

Mark
Fri Dec 03 09:23:01 CST 2004

Hi,
If you use a grid to display your data you might want to put:

With yourGrid
.Column1.Header1.Caption = "Dept Id"
.Column2.Header1.Caption = "Dept Name"
EndWith

Hth

Mark

"Mohammed Abdel-Razzak" wrote:

> Dear sirs
> I'm trying to make an alias t my fields but these aliases have spaces as
> follows
>
> SELECT DEPTID as "dept id" , DEPTNAME as "dept name" FROM DEPTS INTO CURSOR
> slctCurs
>
> it gives me a syntax error
> how can I fix that??
>
> thanks
> Mohammed

Re: field alias by Anders

Anders
Fri Dec 03 09:56:23 CST 2004

Hello Mohammed,

If you tables are in a VFP database or are a view then you can set the
Display Caption property in the Table Designer window to 'Dept. name' or
whatever with spaces. This caption will be use in Browse windopws and as
default for a grid column header caption
Open with MODIFY STRUCTURE or through the database Designer and you can make
the change if you have the table and database opened exclusive.

-Anders

"Mohammed Abdel-Razzak" <MohammedAbdelRazzak@discussions.microsoft.com>
wrote in message news:730BD4D8-5433-431E-8A86-8DBFC837671C@microsoft.com...
> Dear sirs
> I'm trying to make an alias t my fields but these aliases have spaces as
> follows
>
> SELECT DEPTID as "dept id" , DEPTNAME as "dept name" FROM DEPTS INTO
CURSOR
> slctCurs
>
> it gives me a syntax error
> how can I fix that??
>
> thanks
> Mohammed