Re: Importing Errors
- From: "Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 1 Apr 2008 08:41:58 +1100
Hi,
some more info please
Do your users get a new ERSCUST.dat file every time they need to import it?
What sort of errors are you seeing?
What happens if you do the thing manually - make a copy of ERSCUST.dat,
rename it to ERSCUST.txt and import it manually?
What happens if you use one of the ERSCUST.dat files that your users are
working with instead of the one you have on your computer now?
Jeanette Cunningham
"RJF" <RJF@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FA1FB168-B2C0-4121-A6BA-8F52400EB465@xxxxxxxxxxxxxxxx
I was having a problem with importing .dat files and Jeanette Cunningham
graciously helped me figure it out.
The code is working perfectly to automatically import the .dat file at the
push of a button. The only problem I'm having now is, when the file is
imported (as a text file) if there are errors, no messages appear to let
the
user know that errors occurred during the import (like the message that
appears when you import manually).
Below is the code I'm using to import the file. I didn't
DoCmd.SetWarnings
False and I've even tried putting DoCmd.SetWarning True at the beginning
of
the code.
I'd appreciate any help.
Thanks,
Private Sub cmd_Import_Click()
On Error GoTo cmd_Import_Click_Err
Dim strFilter As String
Dim strInputFileName As String
Dim SourceFile, DestinationFile As String
Dim strSource As String
Dim strRenamed As String
strFilter = ahtAddFilterItem(strFilter, _
"All Files (*.*)", _
"*.*")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
'remove the file extension from strInputFileName
strSource = Left$(strInputFileName, Len(strInputFileName) - 3)
strRenamed = strSource & "txt"
SourceFile = strInputFileName ' Define source file name.
DestinationFile = strRenamed ' Define target file name.
FileCopy SourceFile, DestinationFile ' Copy source to
target.
DoCmd.TransferText acImportFixed, "ERSCUST_Import_Spec",
"ERSCUST", DestinationFile
Kill DestinationFile
MsgBox "Import Complete", , "Import"
cmd_Import_Click_Exit:
Exit Sub
cmd_Import_Click_Err:
MsgBox Error$
Resume cmd_Import_Click_Exit
End Sub
--
RJF
.
- Prev by Date: Re: TypeGuessRows setting
- Next by Date: Re: TypeGuessRows setting
- Previous by thread: Re: TypeGuessRows setting
- Next by thread: Importing date fields from Excel to Access
- Index(es):
Relevant Pages
|