Results 1 to 8 of 8
  1. #1
    Shenk is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    4

    Question How to change before importing


    Hello!

    There's a thing i need to do. I have many text files of the same format in a folder. Each file's content form is same as following:
    Code:
    formfieldq1=formfieldq1_office2007
    formfieldq2=formfieldq2_201205
    formfieldq3=formfieldq3_yes
    formfieldq4=formfieldq5=formfieldq5_bup1
    formfieldq5_usefulness=formfieldq5_veryuseful
    Ok=Ok
    but if i import the file this way it is no use. Firstly, SOMEHOW, i need to convert this format into the following

    Code:
    office2007 201205 yes bup1 veryuseful
    reason is that when each word i need is in another line, when i import they belong to same column. Instead they should belong to different columns.

    Secondly, I wish to remove the unneccesary strings from the text.

    Using what can I do this? Thank you

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would suggest using VBA to:

    select the text file
    open it
    read it line by line
    parse each line
    write to the table
    close the file.


    I have a 46 page VBA import routine that reads a CSV (text) File, does a lot of processing & lookups, then creates multiple records in multiple tables.

  3. #3
    Shenk is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    4
    Thanks! Can you also suggest a tutorial which is aiming to teach this?

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    This will keep you busy for a while. (See attachment)


    I modified the code in the mdb to help someone else a while ago. Look at the code - see if you can decipher what is happening.
    Any questions, post back. I will be monitoring this thread.

    Have fun...

  5. #5
    Shenk is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    4
    Thanks a lot! I will be looking into this. By the way, i for example say import call list, select the csv file provided, it says Done! xx reads read and written. But it does not change the file? Is it because of my security settings?

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The code reads the CSV file and adds records to the table. Check the number of records in the table, run the code, then check the number of records again. Should be 40 more records.
    If records are not being added, single step through the code to see what is happening. The code is working for me. (Win XP/A2K-A2K3)

  7. #7
    Shenk is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    4
    I have been able to do it!
    Now, can I do this for importing from email instead of importing from text file? I want to download all emails in a folder, apply same editing procedure which I have written, and then save to database.

  8. #8
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I've never tried reading emails, but I think I have seen code that reads emails. Try Googling....

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need help importing to SQL
    By winterh in forum SQL Server
    Replies: 14
    Last Post: 03-28-2012, 12:36 PM
  2. Replies: 5
    Last Post: 01-09-2012, 05:55 PM
  3. Help with Importing
    By Souperbc in forum Programming
    Replies: 2
    Last Post: 04-13-2011, 12:45 PM
  4. Max out after importing only 188 fields
    By weston in forum Import/Export Data
    Replies: 2
    Last Post: 03-06-2011, 12:07 AM
  5. Importing vs. Linking
    By nickanderson in forum Database Design
    Replies: 2
    Last Post: 08-13-2009, 04:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums