I am attempting to import a spreadsheet to Access that contains redundant data. Here is a sample of what data is downloaded:
I can import the data just fine to a temp table I've created with matching fields. However, I can't seem to figure out the SQL string to give me the results that I want. I had it somewhat working and was able to reduce some of the redunancy but in an attempt to make more subqueries to fix the error I completely destroyed it. Now I can't even seem to figure out how I got that far.
Code:
Private Sub cmdImportGrades_Click() On Error GoTo errHandler
Dim fPath As String: fPath = getFilePath
Dim strSQL As String
' Import Data from excel to temp table
DoCmd.TransferSpreadsheet acImport, , "tbl_temp", fPath, 1, "Grades!"
' Append to Gradebook
strSQL = ""
DoCmd.SetWarnings False
DoCmd.RunSQL
DoCmd.SetWarnings True
errHandler_Exit:
Exit Sub
errHandler:
Select Case err.Number
Case 3125
MsgBox "The file isn't formated correctly."
Case 2391
MsgBox "Columns are improperly named"
Case Else
MsgBox "something else: " & err.Number
End Select
End Sub
Desired Results