I've got a DB where I have a table of customers and it only has three fields (customerID, customerFirstName, customer,LastName). I import in a new customer list every week in order to capture new customers. Right now, the code just deletes everything from the table and then appends the new list. Is this the best way to go about it? I ask because outside of new customers and name changes, the overwhelming majority of the data stays the same and idk if deleting it all every time is really necessary or efficient.
I'm fairly new at Access so bear with me. Is there a way that on import, instead of deleting everything, it checks 1) if there's any new customers to add based on customerID & then adds them and 2) if there's any name changes to exisiting customers based on customer ID & then updates them? Below is my current code:
Code:Private Sub bttnImportCustomerList_Click() Dim wdShell As Object On Error GoTo ImportIt_Err Application.FileDialog(msoFileDialogOpen).Title = "Please select the customer list for uploading." Application.FileDialog(msoFileDialogOpen).InitialFileName = "C:\Documents" Application.FileDialog(msoFileDialogOpen).Filters.Add "Excel Spreadsheets", "*.xlsx", 1 Application.FileDialog(msoFileDialogOpen).FilterIndex = 1 Application.FileDialog(msoFileDialogOpen).Show strFile_Path = Application.FileDialog(msoFileDialogOpen).SelectedItems.Item(1) DoCmd.SetWarnings (WarningsOff) DoCmd.OpenQuery "qryClear_CustomerList" DoCmd.RunSavedImportExport "Import-CustomerList" StrResponse = MsgBox("Process Complete!") ImportIt_Exit: Exit Sub ImportIt_Err: MsgBox Error$ Resume ImportIt_Exit End Sub