A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Importing data from delimited text file in Access



 
 
Thread Tools Display Modes
  #1  
Old August 3rd, 2004, 11:03 AM
Vorias Peter
external usenet poster
 
Posts: n/a
Default Importing data from delimited text file in Access

Hello to all! I was assigned a task which involves importing data from a delimited text file in already created tables in Access. I haven't worked at all with vb in Access, so it is kinda difficult for me to make the above task "automated". Is there a way to do this via SQL in Access? The location of the text files is pre-defined. I would appreciate your help, cause I am in big trouble! :-)
  #2  
Old August 3rd, 2004, 12:10 PM
AlCamp
external usenet poster
 
Posts: n/a
Default Importing data from delimited text file in Access

Vorias,
It's not as daunting as it first appears...
Basically, you'll use the TransferText function to programmatically bring
the Ascii/Delimited data into Access.
Here's a sample that imports an Ascii delimited file, using a schema.ini
file called MyImportSpecs, to a table in Access called tblUpdateData.

DoCmd.TransferText acImportDelim, "MyImportSpecs", "tblUpdateData",
[UpdateFilePath] & "\" & [UpdateFileName]

Before I run the command, I get the UpdateFilePath & UpdateFileName from
the user via 2 input boxes, and plug those variables into the function.
([UpdateFilePath] & "\" & [UpdateFileName]).
I develop an Import specification file by importing the data via the
wizard, until I get all the specs correct, and the file data imports
correctly... then using Advanced, I save those Import specs in a schema.ini
file (MyImportSpecs)

Go to Help under TransferText, and build your TransferText function...
step by step.

hth
Al Camp


"Vorias Peter" Vorias wrote in message
...
Hello to all! I was assigned a task which involves importing data from a

delimited text file in already created tables in Access. I haven't worked at
all with vb in Access, so it is kinda difficult for me to make the above
task "automated". Is there a way to do this via SQL in Access? The location
of the text files is pre-defined. I would appreciate your help, cause I am
in big trouble! :-)


  #3  
Old August 3rd, 2004, 12:19 PM
stefan hoffmann
external usenet poster
 
Posts: n/a
Default Importing data from delimited text file in Access

hi,

Vorias Peter wrote:
Is there a way to do this via SQL in Access?


I don't know the correct syntax, but the solution reads somewhat like that:

INSERT INTO YourTable SELECT * FROM [YourTextFile, Specfication for Import]

The other way is to import the text file manually, creating your import
specification and save it. After this you can use DoCmd.TransferText do
redo this job.

-- stefan --
  #4  
Old August 3rd, 2004, 07:34 PM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default Importing data from delimited text file in Access

Have you tried iimporting a few text files by using file-get external
data-import?



--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


  #5  
Old August 4th, 2004, 06:33 PM
Vorias Peter
external usenet poster
 
Posts: n/a
Default Thanks

Thanks man, you don't know from what kind of trouble you got me out! :-)

"AlCamp" wrote:

Vorias,
It's not as daunting as it first appears...
Basically, you'll use the TransferText function to programmatically bring
the Ascii/Delimited data into Access.
Here's a sample that imports an Ascii delimited file, using a schema.ini
file called MyImportSpecs, to a table in Access called tblUpdateData.

DoCmd.TransferText acImportDelim, "MyImportSpecs", "tblUpdateData",
[UpdateFilePath] & "\" & [UpdateFileName]

Before I run the command, I get the UpdateFilePath & UpdateFileName from
the user via 2 input boxes, and plug those variables into the function.
([UpdateFilePath] & "\" & [UpdateFileName]).
I develop an Import specification file by importing the data via the
wizard, until I get all the specs correct, and the file data imports
correctly... then using Advanced, I save those Import specs in a schema.ini
file (MyImportSpecs)

Go to Help under TransferText, and build your TransferText function...
step by step.

hth
Al Camp


"Vorias Peter" Vorias wrote in message
...
Hello to all! I was assigned a task which involves importing data from a

delimited text file in already created tables in Access. I haven't worked at
all with vb in Access, so it is kinda difficult for me to make the above
task "automated". Is there a way to do this via SQL in Access? The location
of the text files is pre-defined. I would appreciate your help, cause I am
in big trouble! :-)



  #6  
Old August 4th, 2004, 06:35 PM
Vorias Peter
external usenet poster
 
Posts: n/a
Default Importing data from delimited text file in Access

Thanks a lot Stefan about the SQL tip. I was not sure whether such a "select" could work in Access, but now I'll give it a shot! :-)


"stefan hoffmann" wrote:

hi,

Vorias Peter wrote:
Is there a way to do this via SQL in Access?


I don't know the correct syntax, but the solution reads somewhat like that:

INSERT INTO YourTable SELECT * FROM [YourTextFile, Specfication for Import]

The other way is to import the text file manually, creating your import
specification and save it. After this you can use DoCmd.TransferText do
redo this job.

-- stefan --

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Images in a database Franz General Discussion 10 October 7th, 2004 09:35 AM
Recovering Access 2002 data file w/out Workgroup Adminstrator file CJ General Discussion 1 August 3rd, 2004 07:22 AM
Importing a Text File patm General Discussion 2 July 8th, 2004 04:30 PM
SaveAs for tab delimited text file Mark Worksheet Functions 2 June 16th, 2004 03:34 PM
get data from a text file and insert them in datasheet to show a chart in VBA Frank Worksheet Functions 1 June 9th, 2004 09:27 PM


All times are GMT +1. The time now is 11:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.