AccessAggrieved
New member
- Local time
- Today, 18:50
- Joined
- Feb 21, 2013
- Messages
- 2
Hi there,
I am pretty new to Access, VBA and the like, and i need your help.
I need to implement an import function to import data from various excel sheets. I would be able to delete the old content und import the new data via DoCmd.TransferSpreadsheet and SQL, but in this case all changes need to be tracked, so that we can tell what the data in a record was at a given time. So deleting is no option; instead i use a kind of "soft-delete" by setting validFrom- and validTo-Dates for each record.
The import then needs to behave like this (these are all cases i can think of; if i forgot something, please tell me):
- all records in the exceldocument need to be compared to the dtata in the DB
- are DB-record and Excel-record equal, then do nothing
- is a record in the Excelfile, but not in the DB, then create a new DB record
- are the DB-record and the corresponding Excel-record not equal, then soft-delete the old DB-record and create a new one with the given Excel-data
- is a record in the DB but not in the Excelfile, then soft-delete the DB-record
here is an easy example:
DB:
User1 | Data1
User2 | Data2
User3 | Data3
Excel:
User1 | Data1
User2 | Data9
User4 | Data4
DB after import:
User1 | Data1
User2 | Data2 validTo set
User2 | Data9
User3 | Data3 validTo set
User4 | Data4
User1 is unchanged.
User2 has changed, so the old DB-record is invaildated and a new one has been created.
User3 does not exist anymore, so the DB-record has been invalidated.
User4 is new, so a new DB-record has been created.
I have no idea how to implement this behaviour, so please give me a hint.
Thanks in advance
I am pretty new to Access, VBA and the like, and i need your help.
I need to implement an import function to import data from various excel sheets. I would be able to delete the old content und import the new data via DoCmd.TransferSpreadsheet and SQL, but in this case all changes need to be tracked, so that we can tell what the data in a record was at a given time. So deleting is no option; instead i use a kind of "soft-delete" by setting validFrom- and validTo-Dates for each record.
The import then needs to behave like this (these are all cases i can think of; if i forgot something, please tell me):
- all records in the exceldocument need to be compared to the dtata in the DB
- are DB-record and Excel-record equal, then do nothing
- is a record in the Excelfile, but not in the DB, then create a new DB record
- are the DB-record and the corresponding Excel-record not equal, then soft-delete the old DB-record and create a new one with the given Excel-data
- is a record in the DB but not in the Excelfile, then soft-delete the DB-record
here is an easy example:
DB:
User1 | Data1
User2 | Data2
User3 | Data3
Excel:
User1 | Data1
User2 | Data9
User4 | Data4
DB after import:
User1 | Data1
User2 | Data2 validTo set
User2 | Data9
User3 | Data3 validTo set
User4 | Data4
User1 is unchanged.
User2 has changed, so the old DB-record is invaildated and a new one has been created.
User3 does not exist anymore, so the DB-record has been invalidated.
User4 is new, so a new DB-record has been created.
I have no idea how to implement this behaviour, so please give me a hint.
Thanks in advance