Export to Database File

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Export to Database File

Post by JIGYANSHA1985 »

Sir,
I am using Excel 2003 and Visual FoxPro 6.0.

In an excel file there are a few fields from Column A to Column E... Those fields are RECNO, NAME, DOJ, EMP_CD,CREDIT ...

There are also a few records within that ... What I would like to do export the total excel sheet to a .dbf file. But the Fields should specifed length in excel in such a way that when the data export shall be made from excel to .dbf file, it will copy all the records within the excel sheet within that range. Is there any macro to solve the said problem ...

I made an attempt to export the datas from excel sheet to .dbf file from the file menu through SAVE AS option. In this way data are exported to .dbf file if it choosen on database format. But database shall be created only if it is normally an excel file(There is no border outline, header footer name specified and other excel formatting as used ). Evenif it was creted the length I have to specified thereafter by using the database file. Very clumsy procedure .. I would rather required a macro that would copy the records with specified field name by removing all excel based formatting.

The field length may be :-
RECNO NUM(3)
NAME CHAR(30)
DOJ DATE(8)
EMP_CD NUM(6)
CREDIT NUM(10)

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Export to Database File

Post by HansV »

I don't understand your question, If you save an Excel sheet as a .dbf file, only the values will be exported, not formatting such as borders, or headers and footers, because a database table doesn't have those.
Best wishes,
Hans

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Re: Export to Database File

Post by JIGYANSHA1985 »

Sir,

Actually I failed to create .dbf files in excel save as mode having formatting. Secondly, the .dbf files that are being created are to modified the structure later. Is it possible that a macro could created the field type & length specified database ...

Regards
Jigyansha

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Export to Database File

Post by HansV »

I'm afraid I can't help you with this. I'm using Excel 2007, and Microsoft has removed all support for importing/exporting .dbf files from this version.

Perhaps you can use Foxpro Export : DBF Converter & DBF Viewer or Excel FoxPro Import, Export & Convert Software but neither is free.
Best wishes,
Hans

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Export to Database File

Post by Wendell »

JIGYANSHA1985 wrote:Actually I failed to create .dbf files in excel save as mode having formatting. Secondly, the .dbf files that are being created are to modified the structure later. Is it possible that a macro could created the field type & length specified database ...
Have you considered saving the Excel worksheet as a delimited text file (comma or tab delimited), and then importing it into Fox Pro. I am not a Fox Pro user, but nearly all database products can import a text file. Using that approach you may also be able to design and save an empty table and then simply import the text file directly into the table.
Wendell
You can't see the view if you don't climb the mountain!