G
Guest
I have a table, AssetMaster that contains these fields in each row):
AssetID (primary key) AssetLocation AssetName AssetValue
I have a spreadsheet, that I import into a temporary table (AssetUpdate)
that contains:
- New Asset rows
- Existing asset rows with possibly some fields changed
- and it does NOT contain assets that should be deleted (ie, the importing
spreadsheet is a complete superset that should replace the existing
AssetMaster, so if an asset is NOT in the AssetUpdate tbl, it needs to be
deleted from the master). AssetUpdate contains these fields in each row:
AssetID (PK) AssetLocation AssetName AssetValue AssetDesc AssetOwner
(ie, two more fields than what I carry in the asset master table that I do
not need in Asset master)
I need to "refresh" the asset master table to:
- Include any asset rows not already in the file (append)
- Update any "changed" fields
- Delete rows from the AssetMaster NOT including in AssetUpdate
I was thinking I could do this:
- DROP all rows from AssetMaster
- Insert all rows from AssetUpdate (dropping fields I do not need)
however, this is a little kludgy. Is it possible to do this update in one
query? Note that eventually, I will make this a VBA routine, but for now,
just trying to get it to work using Access/Action queries (or some combo).
Any help/suggestions would be appreciated.
AssetID (primary key) AssetLocation AssetName AssetValue
I have a spreadsheet, that I import into a temporary table (AssetUpdate)
that contains:
- New Asset rows
- Existing asset rows with possibly some fields changed
- and it does NOT contain assets that should be deleted (ie, the importing
spreadsheet is a complete superset that should replace the existing
AssetMaster, so if an asset is NOT in the AssetUpdate tbl, it needs to be
deleted from the master). AssetUpdate contains these fields in each row:
AssetID (PK) AssetLocation AssetName AssetValue AssetDesc AssetOwner
(ie, two more fields than what I carry in the asset master table that I do
not need in Asset master)
I need to "refresh" the asset master table to:
- Include any asset rows not already in the file (append)
- Update any "changed" fields
- Delete rows from the AssetMaster NOT including in AssetUpdate
I was thinking I could do this:
- DROP all rows from AssetMaster
- Insert all rows from AssetUpdate (dropping fields I do not need)
however, this is a little kludgy. Is it possible to do this update in one
query? Note that eventually, I will make this a VBA routine, but for now,
just trying to get it to work using Access/Action queries (or some combo).
Any help/suggestions would be appreciated.