Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2004
    Location
    Derry, Derry, Ireland, Northern
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TransferText Method (Access 2000)

    HI folks,

    Having a problem here that I cannot figure out. Trying to import from a text file. If I use a simple sample file I can use the code in 'frmWater_Sample_Import' to select and import a csv file to an existing table BUT when I use the attached csv file and code the import always fails, giving the message "The field F1 doesn't exist in the detaination table".

    I can't figure out why. The field types are all text as is the input, there are no stray items in the csv file...am I missing something simple?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: TransferText Method (Access 2000)

    No idea what the real cause is, but it works if I create an import specification and use this in the code.

    To create an import spec: start the import manually (File | Get External Data | Import...).
    Follow the steps of the Wizard, but before clicking Finish, click Advanced.
    You will see an overview of the settings; click Save As... and give the specification a name, for example SampleSpec.
    You don't actually need to click Finish (unless you want to test if it works; don't forget to delete the imported records.)

    Next, open the code module of the form, and add the specification name to the TransferText instruction:

    DoCmd.TransferText acImportDelim, "SampleSpec", "tblWater_Sample_Temp", docloc, False

  3. #3
    Lounger
    Join Date
    Jan 2004
    Location
    Derry, Derry, Ireland, Northern
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TransferText Method (Access 2000)

    Hi,

    Once again, thanks! A curious problem. Since the specification is optional, you'd think you could leave it out [img]/forums/images/smilies/smile.gif[/img])) but hey.. nice work. Maybe you could help MS write their software? [img]/forums/images/smilies/smile.gif[/img]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •