Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import .csv to access database

Status
Not open for further replies.

MerlinKnight

Technical User
Jan 5, 2005
7
US
OK, i have been trying to figure this out and have ran out of ideas.I need to import a .csv file.
The .CSV file at the beginning has
:mode=ask ( want to delete this and then put it back when i recreat the .csv file later.
then the next line has
:IOAccess, Application, etc
Then the next row's has the data for of these columns.

No problem except there is another field column with more data.
:IOREAL,group, etc
Then more data for each column. Then another row.
:MemDic, group, etc
Then more data.

What i need is the ability to import each of the :name rows and data into different databases to be able to look at the different data types and data collected in each area.
Do changes and then put it back into a .csv files like it was before but with the corrected data.
This will help me correct problems in a Wonderware app. database.

Any suggestion would greatly be appreciated.

 
I think you may have a sticky situation. IF the file you're attempting to import has different record types in it, and you want to import the rows into appropriate tables, then you'll need to write some code to procedurally do this - I don't think you'll be able to directly 'import'.

You'll need to identify the file as a text file and OPEN it for reading - then read the first row, and depending on content, branch to a chunk of code that will import the rows below it to the specific table..

Keep reading each row, one at a time, and either plop the data into a table, or branch to the chunk of code that handles that "type" of data. Lot of looping back and forth, but that's the only way I know of to import differing record types in one file.

Does this make sense to you? If not, can you post a quick sample of what the actual rows look like?

Jim


--------------------------------------
"For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled." - Richard P. Feynman
More Access Help:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top