+ Reply to Thread
Results 1 to 27 of 27

Mapping fields in Excel to prepare them for Access import.

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Mapping fields in Excel to prepare them for Access import.

    I've been working on this for about a week trying different things and can't quite figure this one out. I have included some example files I would like to pull in and the fields I need are below. There are alot of fields and each time it could be different but below are the ONLY fields I am trying to have when I am done. I would like to be able to save the file with these fields as a prn file or a new excel sheet with any filename but I will keep it the same so I can pull it into access.

    The ONLY fields I need in the exported file would be:
    Full Name, Mailing Address, Mailing City, Mailing State, Mailing ZIP, Mailing Country, Property Address, Property City, Property State, Property ZIP.
    Attached Files Attached Files
    Last edited by carden2; 10-01-2012 at 03:29 PM.

  2. #2
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    anyone have any ideas?

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    anyone have any ideas?

    Thanks.

  4. #4
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    still looking for help with this. I would appreciate any help.

    Thanks.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Mapping fields in Excel to prepare them for Access import.

    The first thing I note is that the fields you have named in your thread are not related to the field names in your spreadsheets. How about identifying which fields in which spreadsheet you want. Something like example1.ownerfirst concatenated with example1.ownerlast,etc. Otherwise we will not know what you want.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Quote Originally Posted by alansidman View Post
    The first thing I note is that the fields you have named in your thread are not related to the field names in your spreadsheets. How about identifying which fields in which spreadsheet you want. Something like example1.ownerfirst concatenated with example1.ownerlast,etc. Otherwise we will not know what you want.
    alright sounds good. I'll post more detail. Thanks.

  7. #7
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Example 1
    Full Name- Ownerfirst ownerlast
    Mailing Address- mailnumber, mail street
    Mailing City- mail city
    Mailing State- mail state
    Mailing Zip- mailzip
    Property Address-site Number, site street
    Property City-site city
    Property State-sitestate(if listed)
    Property Zip-site zip

    Example 2
    Full Name- Ownerfirst ownerlast
    Mailing Address- mailnumber, mail street
    Mailing City- mail city
    Mailing State- mail state
    Mailing Zip- mailzip
    Property Address-site Number, site street
    Property City-site city
    Property State-sitestate
    Property Zip-site zip

    Example 3
    Full Name- Ownerfirst ownerlast
    Mailing Address- mail address
    Mailing City- mail city
    Mailing State- mail state
    Mailing Zip- mail zip code
    Property Address-property city
    Property State- property state
    Property Zip- property zip

    Here is a list of each examples field names I need for each column. I attached an excel file I'd like to paste the correct columns into. I hope this helps. Thanks again for any help.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Anyone has any ideas on how to make a macro that could find the columns in the example files and copy them to the field name they belong too

    Please Login or Register  to view this content.
    I was working on this code just to try to pull the column names and copy them to a 2nd sheet then I could just save the 2nd sheet to import. I was wondering if OR statements could be used to pickup the different column names which correlate to the same field name I am after.
    Last edited by JBeaucaire; 09-30-2012 at 10:19 PM. Reason: Added code tags, as per forum rules. Don't forget!

  9. #9
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    any ideas i get a data mismatch error

  10. #10
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    anyone have any ideas?

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Mapping fields in Excel to prepare them for Access import.

    Now you have confused me more. Are you attempting to merge all three files? I don't understand the relationship between the three files and which data from each file is to be brought to the new file. From your initial thread I thought you wanted some data from each file but not from all three. Please clarify.

  12. #12
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    I just want the macro to work with all three files.

    for instance I will get file example 1 but The ONLY fields I need would be:
    Full Name, Mailing Address, Mailing City, Mailing State, Mailing ZIP, Mailing Country, Property Address, Property City, Property State, Property ZIP.

    Then I would save it so I can import into my database.

    I just need it to work with all three example files because those are the three files I am currently receiving. If I could get it where I could pull the fields I need out of any 3 of the example files and save it as a new excel file sheet then it would save me a lot of time.

    My example was to show what field names from each file pasted under the file name in my field names attachment.

  13. #13
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Does it make sense now?

  14. #14
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    anyone have any ideas?

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Mapping fields in Excel to prepare them for Access import.

    Hi carden2

    In your post #1 you posted 3 example files with totally different file structures (I've looked at this). In your post #7 you posted how these different file structures were to be mapped (I've not studied this).

    Are these the ONLY (3) file structures we're dealing with or are there more.
    If not more are these 3 separate file structures ALWAYS the same?
    If more...how many more...what's their structure?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  16. #16
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Mapping fields in Excel to prepare them for Access import.

    I'd offer this as a starting point.

    Please Login or Register  to view this content.
    I'm sure something will be off, so just experiment with a couple of files in your fPATH folder and then tweak the mapping until the data goes where it should consistently.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  17. #17
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    thanks ill try this in the morning.

    i believe these are the only 3 file structures.

  18. #18
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Mapping fields in Excel to prepare them for Access import.

    Be sure to go through the macro and add any column headings into the correct groups if I missed any of importance.

  19. #19
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    I appreciate the help. I have a folder in my C drive called Access where I put a sample file. It doesn't seem to paste any of the values. I can't figure out what to do. Anyway you could run a test on it with my example files.

    Thanks.
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    anyone have any idea on why the code won't paste any of the columns. It seems like it copies data just doesn't paste?

  21. #21
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Mapping fields in Excel to prepare them for Access import.

    Hi carden2

    I didn't test the code to see if it's giving you what you want...change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    and at least your worksheet gets populated. You'll need to determine if it's the correct data.

  22. #22
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Still doesn't seem to paste any of the information. I am really new to vba code so I am not too sure what I should do to try to make it work. It seems to have the right intention though. To grab columns from a file placed in a folder and copy the columns I am looking for into the excel sheet.

  23. #23
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Mapping fields in Excel to prepare them for Access import.

    Hi carden2

    These are the results I get (attached) when running the code with the change I suggested. As I indicated...don't know if it's the data you're looking for.
    Attached Files Attached Files

  24. #24
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Wow I think that's it. I am going to test this but that seems to work well. I don't know what I did wrong with my file but using your attachment it worked. Thank you very much.

    I have one question so if I come up with other header names do I just put them by the case it goes with?

  25. #25
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Mapping fields in Excel to prepare them for Access import.

    Hi carden2

    Well, as you know JBeaucaire wrote this code but I'd suggest that's what he's inferring here
    Be sure to go through the macro and add any column headings into the correct groups if I missed any of importance

  26. #26
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Mapping fields in Excel to prepare them for Access import.

    Alright. Thanks. I seen that in his reply but wasn't sure if it was referring to the Case statements or not.

    Thanks.

  27. #27
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Mapping fields in Excel to prepare them for Access import.

    Hi carden2

    You're welcome...hope I've been of help...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1