• Import data query (Access 2007)

    Author
    Topic
    #450110

    Can someone help a beginner please. I tend to do things by trial and error, as I’m not experienced enough to remember from the last time

    I’m trying to import a txt file into a temp table from where I can do some other work on the data. I therefore need to ensure the table is blank before I import.

    The import code I am using works perfectly until I delete data then it doesn’t work

    Can anyone help please.

    Ta

    Function ImportClipData()

    ‘Turn warnings off
    DoCmd.SetWarnings False

    ‘delete any existing records
    DoCmd.RunSQL “DELETE * FROM tbl_imp1”

    ‘Import rawData
    DoCmd.TransferText acImportDelim, , “tbl_imp1”, “D:ColinDataScLiveListssclivet26.txt”, False

    End Function

    Viewing 0 reply threads
    Author
    Replies
    • #1105148

      You haven’t told us what exactly the problem is. Do you get an error message? If so, what does it say?

      • #1105152

        Sorry

        The module runs fine but doesn’t transfer any data.

        Colin

        • #1105156

          I cannot see any reason why the import would fail after deleting existing records. What happens if you temporarily change the line

          DoCmd.SetWarnings False

          to

          DoCmd.SetWarnings True

          • #1105175

            Tried that didn’t make any difference

            But, I think I just spotted the problem.

            The table has not been refreshed.

            I think I should add a refresh in there to avoid this issue.

            **************************

            Colin McDonald

            colmacd@btinternet.com

            **************************

    Viewing 0 reply threads
    Reply To: Import data query (Access 2007)

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

    Your information: