F
FPS, Romney
Hi,
I have DirListBox in a global module (see below)
I have a listbox on a form with recordsource = DirListBox
A command button on the form involves a procedure which concludes with a
Kill statement for the contents of the target folder specified in
DirListBox.
Once the Kill statement fires, I would like the listbox to be updated to
display as empty.
Can someone please tell me how to accomplish this?
Thanks,
Mark
Function DirListBox(fld As Control, ID, row, col, code)
' Purpose: To read the contents of a directory into a ListBox.
' Usage: Create a ListBox. Set its RowSourceType to "DirListBox"
' Parameters: The arguments are provided by Access itself.
' Notes: You could read a FileSpec from an underlying form.
' Error handling not shown. More than 512 files not handled.
Dim StrFileName As String
Static StrFiles(0 To 511) As String ' Array to hold File Names
Static IntCount As Integer ' Number of Files in list
Select Case code
Case 0 ' Initialize
DirListBox = True
Case 1 ' Open: load file names into array
DirListBox = Timer
StrFileName = Dir$("P:\_PriorAuth\") ' Read filespec from a
form here???
Do While Len(StrFileName) > 0
StrFiles(IntCount) = StrFileName
StrFileName = Dir
IntCount = IntCount + 1
Loop
Case 3 ' Rows
DirListBox = IntCount
Case 4 ' Columns
DirListBox = 1
Case 5 ' Column width in twips
DirListBox = 1440
Case 6 ' Supply data
DirListBox = StrFiles(row)
End Select
End Function
I have DirListBox in a global module (see below)
I have a listbox on a form with recordsource = DirListBox
A command button on the form involves a procedure which concludes with a
Kill statement for the contents of the target folder specified in
DirListBox.
Once the Kill statement fires, I would like the listbox to be updated to
display as empty.
Can someone please tell me how to accomplish this?
Thanks,
Mark
Function DirListBox(fld As Control, ID, row, col, code)
' Purpose: To read the contents of a directory into a ListBox.
' Usage: Create a ListBox. Set its RowSourceType to "DirListBox"
' Parameters: The arguments are provided by Access itself.
' Notes: You could read a FileSpec from an underlying form.
' Error handling not shown. More than 512 files not handled.
Dim StrFileName As String
Static StrFiles(0 To 511) As String ' Array to hold File Names
Static IntCount As Integer ' Number of Files in list
Select Case code
Case 0 ' Initialize
DirListBox = True
Case 1 ' Open: load file names into array
DirListBox = Timer
StrFileName = Dir$("P:\_PriorAuth\") ' Read filespec from a
form here???
Do While Len(StrFileName) > 0
StrFiles(IntCount) = StrFileName
StrFileName = Dir
IntCount = IntCount + 1
Loop
Case 3 ' Rows
DirListBox = IntCount
Case 4 ' Columns
DirListBox = 1
Case 5 ' Column width in twips
DirListBox = 1440
Case 6 ' Supply data
DirListBox = StrFiles(row)
End Select
End Function