Ok, I stepped into the Debugging mode and Stepped over line by line, it stopped on this line ----> and then went straight to the error handling part of this code.
----> rst.Open "RECDISVOL", cnn2, adOpenKeyset, adLockOptimistic, _
adCmdTableDirect
and RECDISVOL is a table, do you think there is a problem with the Table or this code ?
Sorry if I don't make sense, still new, Company is going to bring an Access expert, but wanted to look into it further to learn.
Sub PopulateTableRECDISVOL()
Dim removeHeader As String
Dim pkgid As String
Dim tracknum As String
Dim priority As String
Dim indate As String
Dim procdate As String
Dim deldate As String
Dim carrier As String
On Error GoTo Err_Duplicate
Do
filename = InputBox("Enter Receiving Filename (filename.ext)", "Receiving File")
If filename = "" Then
MsgBox "Enter Filename", vbOKOnly, "ERROR"
End If
Loop Until filename <> ""
CursorHourGlass
filename = path & filename
----> rst.Open "RECDISVOL", cnn2, adOpenKeyset, adLockOptimistic, _
adCmdTableDirect
Open filename For Input As #1
' Input #1, removeheader, removeHeader, removeHeader, removeHeader, removeHeader, removeHeader, removeHeader' REMOVE HEADER
Do While Not EOF(1)
Input #1, pkgid, tracknum, carrier, priority, indate, procdate, deldate 'WILL NEED TO ADD CARRIER VARIABLE
rst.AddNew
rst!pkgid = pkgid
rst!tracknum = tracknum
rst!priority = priority
rst!indate = indate
rst!procdate = procdate
rst!deldate = deldate
rst.Update
rst.CancelUpdate
Loop
If rst.EOF = True Then
'DO nothing
ElseIf rst.EditMode = adEditAdd Then
rst.CancelUpdate
End If
rst.Close
Close #1
Exit Sub
Err_Duplicate:
If Err.Number = errorNumDup Or Err.Number = errorNumRange Or Err.Number = errorType Then
Resume Next
End If
Err.Raise Err.Number
End Sub