[AccessD] A2003: Merging top 50 files then next 50 files and soon

Stuart McLachlan stuart at lexacorp.com.pg
Mon Aug 4 23:54:53 CDT 2008


I made at least one error :-)

strMergeFile = "MergeFile" & Format(lngCounter,"00")
should be
strMergeFile = "MergeFile" & Format(lngFileCounter,"00")

(lngCounter is used to count the original files in the directory, lngFileCounter is used to 
name the MergeFiles automatically)

Now you should get (unless there are other bugs):

Files 1 - 50 in MergeFile01
Files 51-100 in MergeFile02
Files101-150 in MergeFile03 etc.



On 5 Aug 2008 at 14:17, Darren D wrote:

> Hi Rocky and Stuart
> 
> Stuart I have copied and pasted the code below
> Maybe air code but it's beyond my limited understanding :-)
> I ran it and it errored I have forced it to resume on error
> I can see an output file ending in 00 but I can't delete it whilst the dB is
> open
> I can also see an output file ending in 01 with some of the xml in it
> What happens if there is more that 50 XML Should it create a new 02 file? 
> Way beyond me - Sorry
> 
> Many many thanks
> 
> Darren
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
> Sent: Tuesday, 5 August 2008 11:35 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] A2003: Merging top 50 files then next 50 files and soon
> 
> Something like this? (Aircode so will probably need a fair of checking/cleaning
> up)
> 
> Dim lngCounter as Long
> Dim lngFileCounter as Long
> Dim strFile as String
> DIm strMergeFile as String
> 
> strMergeFile = "MergeFile01"
> open strMergeFile for Output as #1
> strFile = Dir$("*.*")
> 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 = 50 then
> lngFileCounter = lngFileCounter +1
> lngCounter = 0
> close #1
> strMergeFile = "MergeFile" & Format(lngCounter,"00")
> open strMergeFile for Output as #1
> end if
> strFile = Dir$
> Loop until strFile =""




More information about the AccessD mailing list