My database program creates .dbf files, which I understand as being DBase files. I can display, edit and save my progress on these new .dbf files on my form's DBGrid. So, this table works fine with my delphi program. What I'm wondering is why is it that Excel gives me the message "This file is not in a recognizable format." when I try to open the .dbf file that I created with my delphi program?
Excel opens the other .dbf files that came with delphi (such as "clients.dbf" just fine, so what is wrong with the .dbf files that my delphi program is creating? I should be able to open them in Excel or any other program that opens .dbf files, right?
***I have tried seperately using both of these lines below, but it didn't seem to make a difference:
TableType := ttDbase;
TableType := ttDefault;
***Here is how I create a table in the program (pretty much straight out of Delphi Help):
with Table1 do begin
Active := False;
// DatabaseName := '; //Purposely left blank for now.
TableType := ttDbase;
TableName := 'CustInfo';
{ Don't overwrite an existing table }
if not Table1.Exists then begin
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := 'Number';
DataType := ftString;
Size := 10;
end;
with AddFieldDef do begin
Name := 'Name'
DataType := ftString;
Size := 10;
end;
with AddFieldDef do begin
Name := 'Address';
DataType := ftString;
Size := 10;
end;
with AddFieldDef do begin
Name := 'Age';
DataType := ftInteger;
end;
with AddFieldDef do begin
Name := 'Status';
DataType := ftInteger;
end;
end; //end of with FieldDefs do begin
{ Next, describe any indexes }
with IndexDefs do begin
Clear;
{ The 1st index has no name because it is a primary key}
with AddIndexDef do begin
Name := '';
Fields := 'Number';
Options := [ixPrimary];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;
Any help would be greatly appreciated.
cold25
Excel opens the other .dbf files that came with delphi (such as "clients.dbf" just fine, so what is wrong with the .dbf files that my delphi program is creating? I should be able to open them in Excel or any other program that opens .dbf files, right?
***I have tried seperately using both of these lines below, but it didn't seem to make a difference:
TableType := ttDbase;
TableType := ttDefault;
***Here is how I create a table in the program (pretty much straight out of Delphi Help):
with Table1 do begin
Active := False;
// DatabaseName := '; //Purposely left blank for now.
TableType := ttDbase;
TableName := 'CustInfo';
{ Don't overwrite an existing table }
if not Table1.Exists then begin
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := 'Number';
DataType := ftString;
Size := 10;
end;
with AddFieldDef do begin
Name := 'Name'
DataType := ftString;
Size := 10;
end;
with AddFieldDef do begin
Name := 'Address';
DataType := ftString;
Size := 10;
end;
with AddFieldDef do begin
Name := 'Age';
DataType := ftInteger;
end;
with AddFieldDef do begin
Name := 'Status';
DataType := ftInteger;
end;
end; //end of with FieldDefs do begin
{ Next, describe any indexes }
with IndexDefs do begin
Clear;
{ The 1st index has no name because it is a primary key}
with AddIndexDef do begin
Name := '';
Fields := 'Number';
Options := [ixPrimary];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;
Any help would be greatly appreciated.
cold25