Darren D
darren at activebilling.com.au
Thu Feb 14 19:22:30 CST 2008
Stuart Brilliant many thanks - this works wonderfully I now have to get it to do the file copy bit and I am done Again many thanks - Despite the cricket Jibes - Love your work :-) Darren ----------------- T: 1300 301 731 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Thursday, 14 February 2008 5:35 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] A2003:Copying Files-Tricky Take a look at the Split() function. Dim PosMAtches() as String PosMatches() = Split([Possible matches],";") For loopcount = 0 to Ubound(PosMatches()) StrSearch = "C:\*." & PosMatches(loopcount) .... Next On 14 Feb 2008 at 15:11, Darren D wrote: > Hi All > > I have a tricky question - at least it's tricky for me to solve > > I have a field in a table where suffixes and prefixes for files are stored in a > field called "Possible Matches" > > > > Trouble is - it's only one field and the possible prefixes and Suffixes are > separated by SemiColons > > So we may have XML;DOC;TXT;123 etc representing possible Suffix/Prefix > > > > What I want to do is write a file copy routine that looks for any occurrence of > the strings above in any file name in a given location > > And I want that routine to copy any occurrence of the file/s it finds with the > "Possible Matches" in its name to another folder > > > > EG say I have File1.TXT, File2.DOC, 123.PDF, My.INI in the root folder of C:\ > > > > I want the routine to find the txt, doc and pdf files and copy them from the > root folder of C: to a location but ignore the ini > > As neither 'INI' nor 'My' (My.INI) is in the "Possible Matches" field > > > > The file copy stuff I am familiar with but I think the routine would have to > > Some other things I am not so familiar with > > EG PsuedoCode/WorkFlow > > A Count the items in "Possible Matches" by counting the SemiColons > perhaps using InStr (Is that the correct function?) > > B loop the number of times InStr finds a SemiColon > > C For each loop build a search string - In this EG "C:\" & "*TXT*" or > "C:\" &"*DOC*" etc > > D The copy every occurrence of "C:\" & "*TXT*" or "C:\" &"*DOC*" etc to > the desired destination (This bit I can do) And so on > > > > Am I on the right track with the PsuedoCode/WorkFlow? > > > > Make sense? > > > > Any suggestions? > > > > Many thanks in advance > > > > DD > > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.20.4/1277 - Release Date: 13/02/2008 8:00 > PM > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.20.4/1277 - Release Date: 13/02/2008 8:00 PM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.20.5 - Release Date: 14/02/2008 12:00 AM