>Mark,
>
>Hi, I'm getting the fields from the actual table the users will use; the funny thing is that yesterday it was working fine. But today it decided to quit working, and i don't really feel like going to my report and change all my fields data source names just like that. I still want to use the cursor to deploy the data on the report instead of creating another table and include it in the database as a temporary table, which will guarantee field length.
>
>
>>
>>When you are running this at Runtime, are you getting your AFIELDS() data from a different table than your design time one? Maybe the runtime table structure is different.
>>
>>Also, rather that using AFIELDS, you could
>>SELECT * FROM tablename INTO CURSOR cursorname NOFILTER
>>to get a copy of your original table for reporting.
Gil, take a look at your structure array. I've just tried to reproduce the behavior you had... the only thing I can imagine is that you've closed the database before creating the cursor. I even tried to do that myself (CLOSE DATA ALL before Create Cursor ... From Array), but I still got the long names in the cursor. Are you sure your original table is still linked to the database?
I'm using code like this:
*+ copy into a R/W cursor
* copies the currently selected alias into a read/write cursor with identical structure
* 14.10.94 v2.0 found that Append from (dbf("alias")) will work
* 5.09.98 port to VFP
*
* Remark: in versions of Fox prior to VFP5.0 (or maybe 3.0) it was possible for
* a field name to begin with an underscore. Such a field will give an error
* message "Field name is a duplicate or invalid." and this routine will break.
* Parameters
* pcNewAlias - alias for the new cursor
* lpCloseOld - .t. if the originally selected alias should be automatically closed
*-
Para cpNewAlias, lpCloseOld
Local Array laStru(1)
Local lnWArea, lcFileName
=Afiel(laStru)
lnWArea=Sele()
lcFileName=Dbf()
Sele 0
Crea Curs (cpNewAlias) From Array laStru
Appe From (lcFileName)
if lpCloseOld
Use In (lnWArea)
endif