How to add new record in access table

luzz

Registered User.
Local time
Today, 12:13
Joined
Aug 23, 2017
Messages
346
Hello guys, I would like to retrieve excel data from a folder from my desktop into my access.
My code:
Private Sub Command0_Click()
Dim filepath As String
filepath = "C:\Users\chelsia.koh\Desktop\Unused\Fabrication.xlsx"
DoCmd.TransferSpreadsheet acImport, , "ImportFromExcel", filepath, True
End Sub

My code is able to retrieve date from the folder into my table every time i click on "Import" button on my form, but it will not skip adding the existing data and add in the new data into the table as the data set will update every night. How can i only add the new data into the table that i import into access from the folder and skip additional on the existing data?

Thank you! Any helps offer are greatly appreciate! Good day ahead everyone :)
 
add additional column (numeric) to the
worksheet. you must put Column header also.
now, fill the column with series of number starting
from 1 up to the last column adding one
on each row.
this will uniquely identify your rows (records).

edit your table in access to add the
column name from your worksheet.
set its datatype number(long integer).
index, no duplicate.

you should instruct the data entry
operator to fill the column as he
progresses to enter more data.

its an extra work, but i think
who would mind. he will only do
it with some extra strokes.
 
add additional column (numeric) to the
worksheet. you must put Column header also.
now, fill the column with series of number starting
from 1 up to the last column adding one
on each row.
this will uniquely identify your rows (records).

edit your table in access to add the
column name from your worksheet.
set its datatype number(long integer).
index, no duplicate.

you should instruct the data entry
operator to fill the column as he
progresses to enter more data.

its an extra work, but i think
who would mind. he will only do
it with some extra strokes.

Hmm, by adding series number will not help as my excel spreadsheet will import into my access database every morning but i only want the new data to be added into the table that i imported
 
The only way this is possible is if there is something in the original data that uniquely identifies each record.
Without that you have to manually add it as Arne has already suggested.
 
In case its not clear from the last few posts, the unique id field allows you to append the data only where it doesn't already exist i.e. where value of field in Access destination table is Null

In other words use an unmatched query.
 

Users who are viewing this thread

Back
Top Bottom