| Platform: | Microsoft Access |
| Task: | Import a .dbf into an Access database |
| Discussion: | You can import a dbf (or other data file) into an Access database using DoCmd.TransferDatabase. See below for an example of importing a .dbf file. |
| Example: | 'imports a dbf into the database as a table.
'example: ImportDbf "C:\temp","MyFile.dbf","MyFileDataTable"
Public Sub ImportDbf(FilePath, Filename As String, TableName As String)
On Error GoTo Error:
DoCmd.TransferDatabase acImport, "dbase IV", FilePath, acTable, Filename, TableName
Exit Sub
Error:
MsgBox Err.Description
End Sub |