Re: Automatic import not working

Tech-Archive recommends: Speed Up your PC by fixing your registry



How is it "not working now"?

--
-Larry-
--

"Office User" <wabekem@(removetosend)yahoo.com> wrote in message
news:1ECF1751-B317-4495-9E9F-37644BCFCF88@xxxxxxxxxxxxxxxx
> Trying to use code to automatically import txt files in Access
table. The
> code is below. The TransferText part was working before I put in
the
> FileCopy and Kill. In fact it was working too well and just
continued to
> loop through the code and import the file numerous times. Oops!
>
> Any ideas why it's not working now? I don't get any error messages
> specifically. I do see both MsgBox messages though.
> Thanks,
> Marcia
>
> ****************************
> Private Sub cmdUpdates_Click()
> 'imports daily files run from CMS Supervisor
> 'then moves files to Backup folder on network drive
> 'prints daily report
>
> On Error GoTo Err_Handler
>
> Dim strfile1, strfile2 As String
> Dim strpath, strpathBackup As String
> strpath = "R:\~Field Support Team\Support Calls\Historical Support
> Calls\Daily Calls\"
> strpathBackup = "R:\~Field Support Team\Support Calls\Historical
Support
> Calls\Backups\"
>
> ChDir (strpath)
> strfile1 = Dir("*calls.txt")
> Do While Len(strfile1) > 0
> 'imports calls file to All Calls table
> DoCmd.TransferText acImportDelim, "Calls Import Specification",
"All
> Calls", strpath & strfile1, False
> 'moves files to Backup folder
> FileCopy strpath & strfile1, strpathBackup & strfile1
> Kill strpath & strfile1
> strfile1 = Dir
> Loop
> MsgBox "Call file has been updated"
>
> strfile2 = Dir("*.agents.txt")
> Do While Len(strfile2) > 0
> 'imports agent file to Agent Data table
> DoCmd.TransferText acImportDelim, "Agents Import Specification",
"Agent
> Data", strpath & strfile2, False
> 'moves files to Backup folder
> FileCopy strpath & strfile1, strpathBackup & strfile1
> Kill strpath & strfile1
> strfile2 = Dir
> Loop
> MsgBox "Agent file has been updated"
>
> Exit_Handler:
> Exit Sub
>
> Err_Handler:
> MsgBox "Error " & Err.Number & " - " & Err.Description,
vbExclamation,
> conMod & ".ShowHighligher"
> Resume Exit_Handler
>
> End Sub
>


.


Quantcast