Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Refering to the table (Access 2000)

    I want to build function that clears the files listed in the table ListDB. This table consists of two fields, Folder and DatabaseList.I have to copy manually the paths for example Kill "C:bebe.mdb "
    but is it possible to refer to them from the table directly in code?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: Refering to the table (Access 2000)

    You could use something like this:

    Sub DeleteFiles
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim strPath As String
    Dim strFile As String

    On Error GoTo ErrHandler

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("ListDB", dbOpenDynaset)
    Do While Not rst.EOF
    strPath = rst!Folder
    If Not Right(strPath, 1) = "" Then
    strPath = strPath & ""
    End If
    strFile = rst!DatabaseList
    Kill strPath & strFile
    rst.MoveNext
    Loop

    ExitHandler:
    On Error Resume Next
    rst.Close
    Set rst = Nothing
    Set dbs = Nothing
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •