• TransferText Method (Access 2000)

    • This topic has 4 replies, 2 voices, and was last updated 21 years ago.
    Author
    Topic
    #405498

    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?

    Viewing 1 reply thread
    Author
    Replies
    • #833457

      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

      • #833473

        Hi,

        Once again, thanks! A curious problem. Since the specification is optional, you’d think you could leave it out )) but hey.. nice work. Maybe you could help MS write their software?

      • #833474

        Hi,

        Once again, thanks! A curious problem. Since the specification is optional, you’d think you could leave it out )) but hey.. nice work. Maybe you could help MS write their software?

    • #833458

      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

    Viewing 1 reply thread
    Reply To: TransferText Method (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: