?
Solved

Importing data to MS Access from MS Excel

Posted on 2014-04-20
3
Medium Priority
?
62 Views
Last Modified: 2015-07-26
I have 1000 rows or "records" of applications in my excel spreadsheet.  But they only represent 100 unique devices that are already represented in my MS Access database.   I have successfully linked my excel spreadsheet, I have even been able to move it to a table, but this is not enough.  

I want to get the data into it's respective tables and associated with the respective machines.   I'm stuck at this point.   MS Office 2010.
0
Comment
Question by:egalois
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 40011855
need more info.  Would need to know the structure of your source table (the linked Excel file) and of the data table(s) you are trying to import it into.  Also would need to know what the Primary Key (unique field in your main table) field is and what the Foreign Key field (the field in your Excel table that identies how each of the 1000 records relate to the 100 unique devides.
0
 

Author Comment

by:egalois
ID: 40011872
The excel sheet is 5 columns titled with CamelCase.  The columns are each formatted as text;  HostName, Application, AppVersion, ProductKey, Maker,      

The primary key in the Main table is autogenerated by MS Access.  Default type auto key.  

The key in my excel sheet is also generated by Access on import - I can easily just delete the link and table I've created and import it again with a different key though.  Just "autogenerate" is what I happened to choose in my experiment.  

The data tables that are in the database begin with Assets, and then are distributed based on "Subject" or "Description of Subject" - a moderately designed, normalized database.   So for example, in the Assets table there is a one to many link from "AssetsID" to a "join" table that includes "ApplicationID"...    

The idea being, I can look up an asset and see what applications are installed.   I can elaborate on any point here but not sure specifically where to elaborate.   Or how best to show what I have....    

Application table:

tblApplication

ApplicationInternalIdentifier
Application
Maker
AppVersion

tblAsset

HostName
AssetTypeID
AssetModel
AssetInernalIdentifier

Maybe I can clarify my question further by saying there are many examples and tutorials on how to import data into a single table.  But I'm needing to bring my data into my database and distribute it appropriately to the respective fields in across many tables.  

I imagine I might create a query that includes all the fields, in all the tables that I'm bringing the data in for, and then some how reverse the process so that when the query is run, it moves the data to the respective fields from my inport into the tables....  I'm missing a fundamental understanding.
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 40012264
So, what we know you have now is at least two tables, Assets (which represent the host computer name) and Applications (which represents the applications installed across all of the machines).  You will need a third table, AssetApps, which keeps track of the applications installed on each host, and possibly the product key for that app, with fields of HostID, AppID.

Assuming that your Assets table has a record for each host, you would need to start out by confirming that each Application is represented in tblApplication.  I would write an append query similar to:

INSERT INTO tblApplication (Application, Maker, AppVersion)
SELECT EF.Application, EF.Maker, EF.AppVersion
FROM ExcelFile EF
LEFT JOIN tblApplications A
ON EF.Application = A.Application
AND EF.Maker = A.Maker
AND EF.AppVersion = A.AppVersion
WHERE A.ApplicationInternalIdentifier IS NULL

This will ensure that each application, version is adequately represented in tblApplications.

Then, you will need to create another query that joins the Excel File to both the Assets table (on HostName) and tblApplications (on the Maker, Application, and AppVersion columns).  Save this query (qry_EF_with_PKs) and use it in another query to update your AssetApps table.  You will probably need to do that in three steps.

1. Update records already in the AssetApps table with the current version and product key if the combination of AssetInernalIdentifier and ApplicationInternalIdentifier already exist

2.  Append new records that are not already a part of the AssetApps table

3.  Delete records that are in the AssetApps table that are not in the Excel table.  Instead of doing a bulk delete I would display this list in a form or report so that you can validate that those application/version combinations are no longer installed and then delete them via a form with a Delete button.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question