PC Review


Reply
Thread Tools Rate Thread

purge files with vb and access queries

 
 
brian
Guest
Posts: n/a
 
      1st Aug 2003
I have a VB app that searches 5 directories from the
root.

For example:

Function PurgeJobFiles()
Dim db As Database, rs As Recordset
Const OMNIchrd_PATH = "N:\OMNIchrd\"

On Error Resume Next

Set db = DBEngine.Workspaces(0).Databases(0)
Set rs = db.OpenRecordset("qryDelete_Shop_File",
DB_OPEN_DYNASET) ' Create dynaset.

rs.MoveFirst ' Move to first record.
If Err <> 0 Then
rs.Close ' Close recordset
On Error GoTo 0 ' Reset error processing
Exit Function ' Exit
End If

Do Until rs.EOF ' Loop until no matching
records.
Kill OMNIchrd_PATH & rs!JOB_NO & "*.*" '
Delete OMNI files.

rs.MoveNext ' Move to next record.
Loop ' End of loop.
MsgBox "Files have been deleted", vbOKOnly, "Deleted
Files"
rs.Close ' Close recordset
On Error GoTo 0 ' Reset error processing

End Function

This deletes every record in the root directory that
matches the query. I have been given a new task to
search directories with sub directories within
subdirectories. Is there a dynamic way of searching
through the root directory and hit all the sub
directories?

Thanks

 
Reply With Quote
 
 
 
 
Lance McGonigal
Guest
Posts: n/a
 
      4th Aug 2003
If you continue to use the Dir statement doesn't it show full path names for
everything in the directory and it's subs? If so, just store in a temp
table and compare to the query via a join. delete the survivors.

Just a thought

Lance

"brian" <(E-Mail Removed)> wrote in message
news:0bd501c35848$7011a500$(E-Mail Removed)...
> I have a VB app that searches 5 directories from the
> root.
>
> For example:
>
> Function PurgeJobFiles()
> Dim db As Database, rs As Recordset
> Const OMNIchrd_PATH = "N:\OMNIchrd\"
>
> On Error Resume Next
>
> Set db = DBEngine.Workspaces(0).Databases(0)
> Set rs = db.OpenRecordset("qryDelete_Shop_File",
> DB_OPEN_DYNASET) ' Create dynaset.
>
> rs.MoveFirst ' Move to first record.
> If Err <> 0 Then
> rs.Close ' Close recordset
> On Error GoTo 0 ' Reset error processing
> Exit Function ' Exit
> End If
>
> Do Until rs.EOF ' Loop until no matching
> records.
> Kill OMNIchrd_PATH & rs!JOB_NO & "*.*" '
> Delete OMNI files.
>
> rs.MoveNext ' Move to next record.
> Loop ' End of loop.
> MsgBox "Files have been deleted", vbOKOnly, "Deleted
> Files"
> rs.Close ' Close recordset
> On Error GoTo 0 ' Reset error processing
>
> End Function
>
> This deletes every record in the root directory that
> matches the query. I have been given a new task to
> search directories with sub directories within
> subdirectories. Is there a dynamic way of searching
> through the root directory and hit all the sub
> directories?
>
> Thanks
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
importing text files into access and generating queries and reports g_1 Microsoft Access 11 12th Nov 2009 03:53 PM
importing text files into access and generating queries and reports g_1 Microsoft Access Forms 1 7th Nov 2009 02:35 AM
Where does Access Stores Queries, Forms, & Report Design files =?Utf-8?B?V2lsbGlhbSBTLiBIYW5jb2NrIEpyLg==?= Microsoft Access 3 20th Jan 2006 03:52 PM
Force Access to purge its Excel memory? =?Utf-8?B?d2F5bmVtYg==?= Microsoft Access VBA Modules 11 4th Oct 2005 02:46 AM
Naming files in VB produced through Access Queries Sally Microsoft Access Getting Started 2 30th Oct 2003 10:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:07 AM.