Hi there
I am writing the following code to update Access table with data from excelsheet and It works fine if the columns in Access table are same as that of excelsheet. But in case excelsheet has one new column that is not present in Access table then how can we add a new column in Access table and update it using excelsheet data.
Any help would be much appreciated.
Thanks
I am writing the following code to update Access table with data from excelsheet and It works fine if the columns in Access table are same as that of excelsheet. But in case excelsheet has one new column that is not present in Access table then how can we add a new column in Access table and update it using excelsheet data.
Code:
Dim xlpath As String
xlpath = "J:\" & Text40 & "-Sent.xls"
DoCmd.DeleteObject acTable, "excelMaster"
DoCmd.TransferSpreadsheet acLink, acSpreadsheetTypeExcel7, "excelMaster", xlpath, -1
strsql = "UPDATE excelMaster INNER JOIN tblcustomer ON excelMaster.ID = tblcustomer.ID SET tblcustomer.Grading = [excelMaster].[Grading],tblcustomer.[PAF Match Type]=[excelMaster].[PAF Match Type];"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql
DoCmd.SetWarnings True
MsgBox "The Project File " & Text40 & " has been updated in the database"
Any help would be much appreciated.
Thanks