Read and import a Csv file (1 Viewer)

gstylianou

Registered User.
Local time
Today, 21:48
Joined
Dec 16, 2013
Messages
357
Hi all,

I would like to have the help of the most experienced of you to be able to read and import data from an Csv file into a new table in my access database. I have tried some methods but unfortunally i cannot do that

Attached you can find both the Csv file and my database.I will apprechiate if anyone can directly modify my example

Thank you in advanced
 

Attachments

  • ImportCharacterDelimitedFiles.accdb
    576 KB · Views: 29
  • PatientsExample.zip
    332 bytes · Views: 40

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 19:48
Joined
Sep 12, 2006
Messages
15,640
import a csv

do it manually with the external data wizard.

when you understand the options, you can automate it with
Code:
docmd.transfertext ….
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:48
Joined
Feb 19, 2002
Messages
43,231
To expand on Dave's instructions.
Use File/Get External Data/Import --- depending on your version of Access, these might be slightly different.
Walk through the import wizard to choose fields and data types. When they are all defined as you need them to be, press the Advanced button. This will give you an option to save the import Spec. Use a short name that relates to the file being imported such as CustomerImport.

Then you only need a single line of code to import the data and that is the one suggested by Dave. One of the options will be the name of an Import Spec and you will use "CustomerImport" or whatever you named your spec. Reference the file name entered in the form.
 

Users who are viewing this thread

Top Bottom