Re: Automatic import not working
- From: "Larry Daugherty" <Larry.NoSpam.Daugherty@xxxxxxxxxxx>
- Date: Thu, 17 Nov 2005 13:19:07 -0800
Hi Marcia,
I hope you have a backup copy of your application in which the code
last worked.
If you get back to the point where it was working, however feebly,
Make a backup and start over on a copy.
copy another set of target files into the target directory (it
couldn't be that you've deleted all of your target files)?? clean up
the table that receives the data.
I'd put the copy and Kill commands back in and then I'd open that
module and make the Immediate/Debug window visible and put a
breakpoint in before the start of the loop.
Be patient with yourself. If you aren't familiar with the debugger,
refer to help and post back with questions as necessary. You need to
single step thru your code and observe the values in your variables.
See if they're what you expected.
At some point, what you see should differ from what you thought you'd
see.
When you do post back, copy your current procedure code and paste it
into your email.
Your next post will probably be to tell us you have it solved. But do
post back and tell the point of the problem and the fix you applied.
HTH
--
-Larry-
--
"Office User" <wabekem@(removetosend)yahoo.com> wrote in message
news:958BF016-FC7F-48CC-B284-1FD2A8C5CD30@xxxxxxxxxxxxxxxx
> I tried taking the FileCopy and Kill commands out but seems it
doesn't import
> the data at all. Looks like I broke it good!
>
> 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
> 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
> strfile2 = Dir
> Loop
> MsgBox "Agent file has been updated"
>
> Thanks for any insight someone can give.
> Marcia
>
>
> "Office User" wrote:
>
> > By not working I mean it doesn't add the records to my table in
Access. It
> > did add the records (too many times because of the Loop) before I
added the
> > FileCopy and Kill commands.
> >
> > Marcia
> >
> >
> >
> > "Larry Daugherty" wrote:
> >
> > > 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
> > > >
> > >
> > >
> > >
.
- References:
- Re: Automatic import not working
- From: Larry Daugherty
- Re: Automatic import not working
- From: Office User
- Re: Automatic import not working
- From: Office User
- Re: Automatic import not working
- Prev by Date: Re: Creating a unique number MMYY-001 MMYY-002
- Next by Date: Re: make execution wait for button push - like msgbox?
- Previous by thread: Re: Automatic import not working
- Next by thread: Re: Database Exceedes Maximum Size
- Index(es):