Hi Guys,
I have this code that creates a query, then later i just issued the "COPY TO" to copy the result of the query to create an spreadsheet,
you can see in the code i am allowing the user to select the drive letter, folder and allow to type the filename and as default the filename extension is "xls" but guess what, the user using this, has microsoft office 2007 and (the file should be created as "xlsx" well can read also "xls"), the file is created no problem but for some reason the field date which in the query is (ie..08/21/13), then it appears in the spreadsheet as 21-Aug-13, so the thing is i know VFP 9.0 does have problems with excel 2007 and the "Copy To" but i am wondering if there is any away to get the date as 08/21/13 in excel ? i don't know if this problem is for compatibility reason or i am missing something else ? most likely is a combination of the two
Note: the table i use, the field "day" is date field type
Here is the code i have in a command button for running the query and this go into a Grid, for the user to review.
SELECT job_no, employee, time, day, time_type, descrip, descrip2, extra_desc FROM Nengtime WHERE job_no IN (SELECT job_no FROM jobnos) AND !EMPTY(job_no) ORDER BY 4 INTO CURSOR RESULTD READWRITE
IF _tally > 0
WITH Thisform.grid2
.Visible = .T.
.ColumnCount = -1
.RecordSource = 'resultd'
.refresh()
ENDWITH
thisform.command5.Enabled=.t.
thisform.command4.Enabled=.t.
ELSE
Messagebox('There is not result for your Query, Check again your Job No. Entry',0+64,'Ok!')
thisform.command5.Enabled=.f.
thisform.command1.Enabled=.f.
thisform.command4.Enabled=.f.
Endif
i have a command button with this code for sending the result of this query to Excel is as below:
lcd =GETDIR() && to select drive letter and folder dialogo box
gcexc = lcd+ '.xls' && variable that holds the path and the extension filename
gcxls = PUTFILE('EXCEL File:', gcexc, 'xls') && to save file name from dialogo box
IF EMPTY(gcxls) && Esc pressed
CANCEL
ENDIF
COPY TO (gcxls) xls && Create as xls file using the "copy to " command
Thanks in advance
I have this code that creates a query, then later i just issued the "COPY TO" to copy the result of the query to create an spreadsheet,
you can see in the code i am allowing the user to select the drive letter, folder and allow to type the filename and as default the filename extension is "xls" but guess what, the user using this, has microsoft office 2007 and (the file should be created as "xlsx" well can read also "xls"), the file is created no problem but for some reason the field date which in the query is (ie..08/21/13), then it appears in the spreadsheet as 21-Aug-13, so the thing is i know VFP 9.0 does have problems with excel 2007 and the "Copy To" but i am wondering if there is any away to get the date as 08/21/13 in excel ? i don't know if this problem is for compatibility reason or i am missing something else ? most likely is a combination of the two
Note: the table i use, the field "day" is date field type
Here is the code i have in a command button for running the query and this go into a Grid, for the user to review.
SELECT job_no, employee, time, day, time_type, descrip, descrip2, extra_desc FROM Nengtime WHERE job_no IN (SELECT job_no FROM jobnos) AND !EMPTY(job_no) ORDER BY 4 INTO CURSOR RESULTD READWRITE
IF _tally > 0
WITH Thisform.grid2
.Visible = .T.
.ColumnCount = -1
.RecordSource = 'resultd'
.refresh()
ENDWITH
thisform.command5.Enabled=.t.
thisform.command4.Enabled=.t.
ELSE
Messagebox('There is not result for your Query, Check again your Job No. Entry',0+64,'Ok!')
thisform.command5.Enabled=.f.
thisform.command1.Enabled=.f.
thisform.command4.Enabled=.f.
Endif
i have a command button with this code for sending the result of this query to Excel is as below:
lcd =GETDIR() && to select drive letter and folder dialogo box
gcexc = lcd+ '.xls' && variable that holds the path and the extension filename
gcxls = PUTFILE('EXCEL File:', gcexc, 'xls') && to save file name from dialogo box
IF EMPTY(gcxls) && Esc pressed
CANCEL
ENDIF
COPY TO (gcxls) xls && Create as xls file using the "copy to " command
Thanks in advance