Question Programmatically importing flat file comma delimited to my access database

jlopez

New member
Local time
Tomorrow, 00:50
Joined
Nov 8, 2010
Messages
7
Hi, I have one Access Database and i want to import the flat file coming from Cisco Phone Logs, its a comma delimited that contains the column names in the first row, and in the second row, its the data type, then the succeeding rows contains the data of the logs which are in Comma separated values, I want to put it to my created table programmatically, i need help to do the vb scripts so. I used Docmd.TransferText but this will not let me define the row which i wanted to start at row 3.

DoCmd.TransferText acImportDelim, , "tblImportTextFiles", Me.txt_SelectedDirectory & "/" & Me.lst_FilesInDirectory, -1

Attached is the text file i received from Cisco Call Log Applications.
 
Last edited:
import the table. examine the data, and try to establish a reliable way to delete the rows you dont want

eg "delete * from tblImportTextFiles where somefield is null"

then you can do whatever you want with the remaining rows.

You may need an import spec (the second parameter which is currently blank, to import the data exactly as you want)

I generally do this, and also add a lot of extra validation steps, depending on the import.

You can also useful offer a file browesr to let users manually select the file. Everything like this helps the usablity of the app.
 
Thanks Dave i already have a file browser in the form, i only need how to insert the flat flat programmatically.
 
[FONT=&quot]assumming this is my flat file. ( 4 rows)[/FONT]

[FONT=&quot]"A FIELD","B FIELD","C FIELD","D FIELD"[/FONT]
[FONT=&quot]INTEGER,[/FONT][FONT=&quot]INTEGER,[/FONT][FONT=&quot]INTEGER,VARCHAR(50)[/FONT]
[FONT=&quot]1,2222,20130204,XYZ450[/FONT]
[FONT=&quot]1,2223,20130204,XYZ460[/FONT]

[FONT=&quot]I want to append the value of 3rd and 4th row to my table. in my table the fields is already exactly the same with the columns in the flat file. I can append this by opening it to excel and copying it and pasting to my table directly but i want to make one button in the form and append these to the table.[/FONT]

[FONT=&quot]To be appended to my table: [/FONT]tblImportTextFiles

[FONT=&quot]A FIELD B FIELD C FIELD D FIELD[/FONT]
[FONT=&quot]1 2222 20130204 XYZ450[/FONT]
[FONT=&quot]1 2223 20130204 XYZ460[/FONT]
 
Last edited:

Users who are viewing this thread

Back
Top Bottom