If I understand correctly, the Excel file has part numbers that might contain a dash or a space. You want the number in the field PN to be the same as PART_NUMBER minus the dash and/or space.
Try this:
Code:
Private Sub Command17_Click()
Dim strPathFile As String
Dim strTable As String
Dim strBrowseMsg As String
Dim strFilter As String
Dim blnHasFieldNames As Boolean
Dim strSQL As String
' If IsNull(Me!txtPART_NUMBER) Then
' MsgBox "Please provide a Part Number."
' Exit Sub
' End If
If IsNull(Me!txtFILE_PATH) Then
MsgBox "Please browse to a file."
Exit Sub
End If
blnHasFieldNames = True
strPathFile = Me.txtFILE_PATH
strTable = "tblDATA"
Sheet_Name = "EXAMPLE_USER_INPUT" & "!"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTable, strPathFile, blnHasFieldNames, Sheet_Name
' now update the field PN with the value fron field PART_NUMBER.
'use the replace command to first, replace dashes with "", then replace spaces with ""
strSQL = "UPDATE tblDATA SET tblDATA.PN = Replace(Replace([PART_NUMBER],'-',''),' ','')"
strSQL = strSQL & " WHERE [PN] Is Null;"
CurrentDb.Execute strSQL, dbFailOnError
MsgBox ("Done")
End Sub