Question Import data from txt files into Access2003 (1 Viewer)

raghuprabhu

Registered User.
Local time
Yesterday, 22:52
Joined
Mar 24, 2008
Messages
154
I want to import data from the text file. I have been able to do that.

The first line in the txt file is a string "2012/21" and this is causing "New Text Document_ImportErrors".

Questions

1)Field13 in tblData is date in a string format. How do I change it to medium format?

2)How do I insert "2012/21" into a new Field14 for each record?

I have zipped the database and also the data source txt file.

Thank you

Raghu Prabhu
 

Attachments

  • testNRP.zip
    25.5 KB · Views: 70

Alansidman

AWF VIP
Local time
Today, 00:52
Joined
Jul 31, 2008
Messages
1,493
With your table open in design view, create a new field. Close your table. Open a new query in design mode. Change the query to an update query. Where it says update to, type 2012/12.

Here is the SQL statement for your situation based upon the db uploaded.
Code:
UPDATE tblData SET tblData.Field14 = "2012/12";
 

raghuprabhu

Registered User.
Local time
Yesterday, 22:52
Joined
Mar 24, 2008
Messages
154
Thanks Alansidman but every fortnight the number changes. I want to automatically pick up the number and update the field.
 

Alansidman

AWF VIP
Local time
Today, 00:52
Joined
Jul 31, 2008
Messages
1,493
Is the table appended each fortnight or is a new table created with each importation?
 

raghuprabhu

Registered User.
Local time
Yesterday, 22:52
Joined
Mar 24, 2008
Messages
154
Hi Alansidman,

Each fortnight I get a new data source txt file. Next fortnight it is going to have "2012/22" in the first line. I want to append the data into one table and keep adding each fortnight.

Thanks.
 

Alansidman

AWF VIP
Local time
Today, 00:52
Joined
Jul 31, 2008
Messages
1,493
Suggest you import the new data into a temp table. Update it with the new data and then append it to the main table. I cannot think of another means to accomplish your issue. Once you get this set up, you could have it automated with a bit of VBA.

Alan
 

raghuprabhu

Registered User.
Local time
Yesterday, 22:52
Joined
Mar 24, 2008
Messages
154
That is what I have done. Imported into a temp table and updated the required field.
 

Users who are viewing this thread

Top Bottom