Darren D
darren at activebilling.com.au
Wed Aug 6 23:51:39 CDT 2008
Hi Stuart You are a legend this is way cool Now, I have a strange issue with this. When I drop say 20 or 30 xml files in the My Documents folder and run the dB, from My Documents as well, it runs lovely Drop those same XML into another folder and the dB into that same folder it seems to get stuck in some monstrous loop that never ends and the new destination merge file just grows and grows and does not stop until I do a 3 finger salute Any reason why it would work in the My Documents folder and not in another folder? Many thanks Darren -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Wednesday, 6 August 2008 8:06 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] A2003: Merging top 50 files then next 50 files andsoon Yep, another ommission on my part ( I did warn you <g>) You need to do a Close #1 after Loop Until strFile = "" to close the last merge file. It's not using any objects, so there is no need to do anything else. On 5 Aug 2008 at 15:22, Darren D wrote: > > Stuart - Fantastic > > Works an absolute treat many many thanks - you are a legend > > What is the standard code bits to get it to release the file whilst the dB is > open? I also assume there are objects to be closed or set to nothing - yes? > > Code working nicely below > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Private Sub ps_CopyBlocks() > > On Error Resume Next > > Dim lngCounter As Long > Dim lngFileCounter As Long > Dim strFile As String > Dim strMergeFile As String > > strMergeFile = "MergeFile00.txt" > Open strMergeFile For Output As #1 > strFile = Dir$("*.xml") > Do > Open strFile For Input As #2 > While Not EOF(2) > Line Input #2, strtemp > Print #1, strtemp > Wend > Close #2 > lngCounter = lngCounter + 1 > If lngCounter = 10 Then > lngFileCounter = lngFileCounter + 1 > lngCounter = 0 > Close #1 > strMergeFile = "MergeFile" & Format(lngFileCounter, "00" & ".txt") > Open strMergeFile For Output As #1 > End If > strFile = Dir$ > Loop Until strFile = "" > > End Sub -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com