Quote:
Originally Posted by kinuthia54
Hi, I have a macro that combines many worksheets into one and after I need this worksheet to update a Table in Access but only with newly generated records. I have linked the combined worksheet to the Access DB as a table though the table I want to update is different which contains previously generated records. Any ideas, especially if I can add the code to the existing macro or a query that runs when i open the DB.
On little trick that I use when transferring limited information/data between Excel and Access is to use the System Registry for the transference since they will Save and Retrieve data from the same Key using SaveSetting and GetSetting(). A simple example below will illustrate this point:
- In Execl, save the First ID of the newly Added Record:
- SaveSetting appname:="MASTER Worksheet", Section:="Data Merge", _
-
Key:="First ID", setting:=1000000
- In Access, retrieve the ID of the first newly Added Record:
- Dim lngFirstRecID As Long
-
-
lngFirstRecID = GetSetting(appname:="MASTER Worksheet", Section:="Data Merge", _
-
Key:="First ID", Default:="999999")
-
-
If lngFirstRecID = 999999 Then
-
MsgBox "No First Record ID stored"
-
Else
-
MsgBox "First ID of Newly Added Record: " & lngFirstRecID
-
End If