Академический Документы
Профессиональный Документы
Культура Документы
Smart questions
Smart answers
Smart people
Join
Directory
Search
Go Find A Forum Go
Tell A Friend
Whitepapers
Jobs
Home > Forums > Programmers > DBMS Packages > Microsoft: FoxPro (old versions 1 to 2.6) Forum
Thanks, Bill
Enter the commands between the '*...' lines , substituting the correct file names and paths:
*....................................
USE MyTable1
COPY TO F:\SomeDir\MySheet TYPE XLS
CLOSE ALL
*....................................
DO mycvrt
If you don't want to be prompted to overwrite the existing file, add this line at the beginning of the little program:
Keep in mind, there is a record limit of around 16,000 for a Fox table exporting to Excel sheet. If you need more than that, you can export it to a text file
which can be opened with Notepad, Word, whatever, by using:
www.tek-tips.com/viewthread.cfm?qid=468515 1/5
7/20/12 Microsoft: FoxPro (old versions 1 to 2.6) - FP 2.6 DBF file into Excel 2002
Dave S.
In the FoxPro Database the file I am trying to dynamically update to Excel is called Request.DBF, it also has two files called Request.CDX and Request.FPT,
these two files I am not sure what there function in life is....
So, to try and clarify (if needed) what I am trying to accomplish is....Have the 19 field Request.dbf file in FoxPro take 8 fileds and drop them into a Excel
sheet (called say Scheduled.xls) while leaving them in FoxPro as well (CAN NOT alter or hender the real DB)and any time the Request.dbf file is updated
through Foxpro 2.6 have it dynamically update the Scheduled.xls file. If I can get that done then the hyperlink/web page issue I can work out.
Bill
USE MyTable1
DO WHILE .T.
WAIT WINDOW 'Waiting... <Esc> to exit, any other key to update now.' NOWAIT
x=INKEY(300) &&... 300 seconds = 5 minutes.
IF x = 27 &&... Escape key pressed
EXIT
ENDIF
COPY TO F:\SomeDir\MySheet TYPE XLS
ENDDO
CLOSE ALL
Substituting the field names where appropriate, and separating each by a comma.
Dave S.
Thanks I am going to give this a try and see what happens. Hope I do not screw up the DB. I will post again after I try this. I have Visual FoxPro 6 (no, I
do not know how to use it let alone use 2.6 as this is a program created by a governmental organization that is not longer around and I have to try and
keep it working and functional) Would using FoxPro 6 make life any easier?
THANKS again,
Bill
Dave S.
Excel sheet name is CURRENT.XLS located at G:\REQUESTS. I run the below file and get a "MEMO File is missing/Invalid" and can not go any further.
USE G:\REQUESTS\REQUEST.DBF
COPY to G:\REQUESTS\CURRENT TYPE XLS
CLOSE ALL
Ideas??
Have not tackled the Loop thing yet, but will give it a try. My next question of many (and hope no one minds, as I am really trying to learn this stuff, just
above my head, never been a DB Guru) is I have the fields copying over, but is there a way to place the fields in a certain order when running th DO
MYCVRT?
THANKS Dave S.
In the FoxPro Database the file I am trying to dynamically update to Excel is called Request.DBF, it also has two files called Request.CDX and Request.FPT,
these two files I am not sure what there function in life is....
Request.CDX is an idex file used for rapid access of the .DBF records.
Request.FPT is memo file, one that stores variable length data from a "Memo" field. Now in order to use your 'Request' table, without getting into why,
those files need to be located where the .DBF file is. Of course, there are ways around it but suffice it to say that for what you need, they need to be
there. So if you're getting that error, are you by chance working with a backup of your original?
Now, on to something else. I'm feeling alittle silly right now, as I forgot all about a little routine in VFP. It's call GenHTML. If you open up VFP 6 where
your Request table is, you can issue the following:
Dave S.
www.tek-tips.com/viewthread.cfm?qid=468515 3/5
7/20/12 Microsoft: FoxPro (old versions 1 to 2.6) - FP 2.6 DBF file into Excel 2002
DSummZZZ (Programmer) 6 Feb
03
18:57
You can arrange them in what ever order you want in the copy to line.
Renaming though is not doable.
You do have this option. Run a query on the table in the loop:
USE MyTable1
DO WHILE .T.
WAIT WINDOW 'Waiting... <Esc> to exit, any other key to update now.' NOWAIT
x=INKEY(300) &&... 300 seconds = 5 minutes.
IF x = 27 &&... Escape key pressed
EXIT
ENDIF
SELECT Unit_Name AS Organization, Field1, Field2 AS Whatever, ..., ;
FROM Request INTO CURSOR tmp
SELECT tmp
COPY TO F:\SomeDir\MySheet TYPE XLS
ENDDO
CLOSE ALL
But, think about the other suggestion using VFP 6. You can still do the loop and have it directly export to HTML.
Dave S.
I would love to be able to use VFP 6. Because the HTML is exactely waht I am looking for at a end state, I have it installed, but that is it. I know nothing
about it and do not want to pretend I do.
The sort order may be a challenge. What this is is a program to schedule ranges and Airspace for the U.S. Army. I need to place some of the information
from when a unit schedules a piece of ground or air to show the powers-to-be in a HTML format or.... what is scheduled on a particular day and time and
location and what that unit is doing with that piece of ground/air. The feilds MUST stay together for a particular record. What shows when I do the
MYCVRT in Excel is Tra_Area (thats the ground/Air), STARTDAY (Day of starting), ENDDAY (Day it ends), TRAINING(what they are doing). If I sort this all
of the fields for that day MUST coiencide. Do not see how to sort one feild and maintain its relationship with the other 4 or 5 fields.
USE G:\REQUESTS\REQUEST.DBF
DO WHILE .T.
WAIT WINDOW 'Waiting... <Esc> to exit, any other key to update now.' NOWAIT
x=INKEY(300) &&... 300 seconds = 5 minutes.
IF x = 27 &&... Escape key pressed
EXIT
ENDIF
SELECT STARTDAY, ENDDAY, TRAINING, ;
Unit_Name AS Organization, Tra_Area ;
FROM Request ;
ORDER BY STARTDAY;
INTO CURSOR tmp
SELECT tmp
COPY to G:\REQUESTS\CURRENT TYPE XLS
www.tek-tips.com/viewthread.cfm?qid=468515 4/5
7/20/12 Microsoft: FoxPro (old versions 1 to 2.6) - FP 2.6 DBF file into Excel 2002
ENDDO
CLOSE ALL
As you can see, I selected the fields, and ordered them by startday. Then it gets copied to the output file.
Now I know I am criss-crossing forums here, but to do this same thing with VFP 6, fire it up and issue a
just like with Foxpro 2.6, from the command window. Then add this code:
USE G:\REQUESTS\REQUEST.DBF
DO WHILE .T.
WAIT WINDOW 'Waiting... <Esc> to exit, any other key to update now.' NOWAIT
x=INKEY(300) &&... 300 seconds = 5 minutes.
IF x = 27 &&... Escape key pressed
EXIT
ENDIF
SELECT STARTDAY, ENDDAY, TRAINING, ;
Unit_Name AS Organization, Tra_Area ;
FROM Request ;
ORDER BY STARTDAY;
INTO CURSOR tmp
SELECT tmp
DO (_GENHTML) WITH "G:\REQUESTS\CURRENT.HTML", "tmp"
ENDDO
CLOSE ALL
Dave S.
Qt Professional Training
Qt Courses - beginner to advanced - given by active Qt Developers
www.kdab.com/training
www.tek-tips.com/viewthread.cfm?qid=468515 5/5