Stuart McLachlan
stuart at lexacorp.com.pg
Thu Feb 14 00:34:33 CST 2008
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