Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Import data query (Access 2007)

    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

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

    Re: Import data query (Access 2007)

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

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Import data query (Access 2007)

    Sorry

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

    Colin

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

    Re: Import data query (Access 2007)

    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

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Import data query (Access 2007)

    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

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

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Import data query (Access 2007)

    Does that solve the problem??

  7. #7
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Import data query (Access 2007)

    Sorry


    yes thanks

Posting Permissions

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