papadega3000
Registered User.
- Local time
- Today, 12:47
- Joined
- Jun 21, 2007
- Messages
- 80
I have created a form that will allow a user to browse for a excel file and then import the excel spreadsheet into a tempTask table and then I want to do a update query on the main source table called Task. Both tables have the same number of columns and same field names but the update query doesn't change/update the records in the main source table Task with the values in TempTask.
Here is my VBA code that I am using.
Any Help would be appreciated thanks.
Here is my VBA code that I am using.
Code:
Private Sub ImportfromExcel_Click()
Dim StrSQL As String
CurrentDb.Execute "DELETE * FROM TempTask"
DoCmd.TransferSpreadsheet acImport, 8, "TempTask", [filepath].Value, True, ""
'StrSQL is an Update String that will compare all of the Current Task in Task Table and
'compare/update them to the currren values in TempTask
StrSQL = " UPDATE Task INNER JOIN TempTask ON Task.Task = TempTask.Task SET Task.Task = [TempTask].[Task], Task.Description = [TempTask].[Description], Task.Points = [TempTask].[Points], Task.Verifier = [TempTask].[Verifier], Task.Attempted_Planned = [TempTask].[Attempted_Planned], Task.Completed_Planned = [TempTask].[Completed_Planned], Task.Verified_Planned = [TempTask].[Verified_Planned], Task.Attempted_Actual = [TempTask].[Attempted_Actual], Task.Completed_Actual = [TempTask].[Completed_Actual], Task.Verified_Actual = [TempTask].[Verified_Actual], Task.Deleted = [TempTask].[Deleted], Task.Notes = [TempTask].[Notes]"
CurrentDb.Execute StrSQL
End Sub
Any Help would be appreciated thanks.