Need help creating a utility to import text files into a table

OrganMan

Registered User.
Local time
Today, 16:03
Joined
Jun 9, 2008
Messages
36
This may be a bigger project than I first thought but what I need to do is import a text file into an existing table. First of all I have created a form with a listbox that I would like to be able to store the text file in. How do I go about loading the text file from my hard drive to the listbox? I then need to parse the text file so that it will import into the proper fields in my table, and finally get the users responses and append these numbers into the YearId field, SetId field, and the SubsetId field, depending on what the user choses as the correct YearId, SetId and SubsetId.

The tricky part is with the text file, all of the formats can be as follows:
CardNum ex: 22
FirstName ex: Babe
LastName ex: Ruth
Rookie ex: R (If it is a rookie card it is always just an R, but not all of the cards in the text file are rookie cards)
AdditionalDescriptionex: Record Breaker

My text files are all space delimited

The table in my db is named ImportingCards and has the following fields:
CardId, AutoNum (will uniquely identify each single card)
CardNum, Text (because cards can be numbered with letters or numbers or both)
FirstName, Text
LastName, Text
Rookie, Yes/No
AdditionDescription, Text
YearID, Number (have all of the years numbered in a Year Table)
SetId, Number (have all of the sets numbered in a Set Table)
SubsetId, Number (have all of the subsets numbered in a Subset Table)


I know that it will be quite a bit of work but could someone please start me in the right direction and maybe break down how I should tackle this, I am just a junior programmer.

Thanks
So much
 
Use the TransferText() function to import the text file into a table. Manually import the text file into a new table to get your table design setup. You will want to purge the import table before each import and then append/update the imported data into your table (which allows you to test the imported data just incase something went wrong). You can add a file open dialog if you want the user to be able to browse and select the file to import. My old Browse [Find a directory or file] sample should help with that.
 

Users who are viewing this thread

Back
Top Bottom