Access
A family of Microsoft relational database management systems designed for ease of use.
336 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Im not sure why I have this code error when trying to import an excel file. Please help.
File Type
Try running this code-
Private Sub GetUmFile()
' ... Your existing code ...
strSQL = "DELETE FROM tblHTSAudit WHERE [ITEM NO] Is Null;"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
' ... Your existing code ...
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Select * From tblHTSAudit")
If Not rs.EOF And Not rs.BOF Then
rs.MoveFirst
While (Not rs.EOF)
' ... Your existing code ...
If rs.Fields("BUSINESS UNIT") <> "Hussmann" And rs.Fields("BUSINESS UNIT") <> "Commercial Insulating Glass" And rs.Fields("BUSINESS UNIT") <> "Commercial Refrigerator Door" Then
' ... Your existing code ...
DoCmd.SetWarnings False
DoCmd.RunSQL sql
DoCmd.SetWarnings True
End If
' ... Your existing code ...
If IsNull(DLookup("HTSUS", "_USHTS", "HTSUS = '" & rs.Fields("HTSUS") & "'")) Then
' ... Your existing code ...
DoCmd.SetWarnings False
DoCmd.RunSQL sql
DoCmd.SetWarnings True
End If
' ... Your existing code ...
If IsNull(DLookup("ECCN", "dbo_ECCN", "ECCN = '" & rs.Fields("ECCN") & "'")) Then
' ... Your existing code ...
DoCmd.SetWarnings False
DoCmd.RunSQL sql
DoCmd.SetWarnings True
End If
' ... Your existing code ...
rs.MoveNext
Wend
End If
rs.Close
' ... Your existing code ...
MsgBox "Done"
End Sub