Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 31519. You cannot import this file 2

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am using access 2003. I am trying to import a file and I keep on getting the error 31519. You cannot import this file. I have tested the mask called IMP_CA_Worx and the mask is working. To do the manual import I had to change the file to a text file. I copied and pasted the file name to verify I was not typing incorrectly. The name of the file is VRA03061(Gragil)_AL.C01. The file is being passed to the procedure without a problem. I have highlighted in blue where the error is. Any help would be appreciated.

Tom


Code:
Private Sub cmdImp_Click()

Dim strFile As String
Dim boolWorx As Boolean

'On Error GoTo Err_Imp

DoCmd.SetWarnings False
' Get File Name
Me.txtFile.SetFocus
strFile = "\\server\xfer\caf\" & (Trim(Me.txtFile.Text))
Me.chkWorx.SetFocus
If (Me.chkWorx.Value = -1) Then
    boolWorx = True
Else
    boolWorx = False
End If
' Process File
With DoCmd
    .OpenQuery "qry_del_ImpTbl"
    .OpenQuery "qry_del_ProcTbl"
End With
If (boolWorx = False) Then
    DoCmd.TransferText acImportFixed, "IMP_CA", "imp_CA", strFile
Else
[Blue]    DoCmd.TransferText acImportFixed, "IMP_CA_Worx", "imp_CA", strFile [/Blue]
End If
With DoCmd
    .OpenQuery "qry_app_PostWOAmts"
    .OpenQuery "qry_updt_MoveDecimal"
End With

DoCmd.SetWarnings True

MsgBox "Successfully Imported!", , "WHOO!"

'Exit Sub

'Err_Imp:
'    MsgBox "ERROR:  This did not work, probably because there is not file by that name in the folder.", , "ERROR"
'    MsgBox "If there is, I blame you, because computers rule!", , "ERROR"
'    Exit Sub
    
End Sub
 
What is the value of Me!txtFile ?
Be sure the extension is a valid one for import ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
What happens if you change the file name to VRA03061_Gragil_AL.TXT?

Also, you shouldn't need to do this
Code:
Me.txtFile.SetFocus
strFile = "\\server\xfer\caf\" & (Trim(Me.txtFile.Text))

Code:
[s]'Me.txtFile.SetFocus[/s]
strFile = "\\server\xfer\caf\" & Trim(Me.txtFile.Value)

Duane
Hook'D on Access
MS Access MVP
 
.C01 is the extension
This is not a valid extension for import.
Either hack the registry to allow it or rename (or copy) the file before import.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
If I change the file extension of the file to .txt the import works. But these files are always going to be named C01. I am hoping there is some work around.
 
A starting point:
Name strFile As strFile & ".txt"
DoCmd.TransferText acImportFixed, "IMP_CA_Worx", "imp_CA", strFile & ".txt"
Name strFile & ".txt" As strFile


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Why would you state "same error" after I stated "What happens if you change the file name to VRA03061_Gragil_AL.TXT?"

As PH suggests, you can rename or copy the file.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top