For example, you may export the following table:
FieldSize property to control the amount of space that is allocated for a particular field. For number fields, you can choose one of the following numeric types from a list:
- Long Integer
Method 1: Modify the database file in dBaseModify the design of the database file after it has been added to the dBase catalog. For example, set the Dec column to 0 (zero). For additional information about designing database files in dBase, see the dBase documentation.
Method 2: Use Microsoft Office Excel to format the dataUse Excel to format the data in the table that you exported. To do this, follow these steps:
- In Excel, open the table that you exported as type dBase IV (*.dbf) from Access.
- Format the cells that are not correctly formatted. To do this, select the cells, and then click Cells on the
- After you have formatted the cells, export the spreadsheet as a dBase IV file. To do this, follow these steps:
- On the Filemenu, click Save As.
- In the Save as type box, click DBF 4 (dbase IV) (*.dbf), and then click Save.
Method 3: Use sample code to format the dataMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
You can use the following code sample to automate the process of formatting the data. The sample will save a table as a text file. Then, it will automate Excel to open the text file and then save it in dBase IV format.
Note You must change the file names in this code sample to match your file names.
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Const SAVETEXT = "C:\testValues.txt"
Const SAVEDBF = "C:\testDBF.dbf"
' Save the table as a text file.
DoCmd.TransferText acExportDelim, , "Table1", SAVETEXT, True
' Set a reference to the Application object.
Set xlApp = CreateObject("Excel.Application")
' Set a reference to the Workbook object.
Set xlBook = xlApp.Workbooks.Open(SAVETEXT, , , 2)
' Save the file to dBase IV format.
xlBook.SaveAs Filename:=SAVEDBF, FileFormat:=xlDBF4
Set xlBook = Nothing
Set xlApp = Nothing
Article ID: 891775 - Last Review: 29 Mar 2017 - Revision: 3