I have a (Access 2000) list box that returns all the files in a directory (CurrentProject.Path & "\Backup") to be used to restore backup of the database. My problem is that the first row of the list always has a double name ie:
Row 1: <Filename1><Filename1>
Row 2: <Filename2>
Row 3: <Filename3>
etc.
I would like to either get rid of the second filename in row 1, or totally mask out the first row, as either solution is acceptable.
Thats all the code for the list box and executes on Form_Load (No more, no less)
Expand|Select|Wrap|Line Numbers
- Dim strDir As String
- Dim strFile As String
- Dim strFolder As String
- strFolder = CurrentProject.Path & "\Backup"
- strDir = strFolder
- lstRestore.RowSourceType = "Value List"
- lstRestore.RowSource = ""
- strFile = Dir(strDir & "\*")
- If strFile = "" Then
- msgbox ("No files found in " & strDir)
- Exit Sub
- End If
- Do While strFile <> ""
- If lstRestore.RowSource = "" Then
- lstRestore.RowSource = strFile
- Else
- lstRestore.RowSource = lstRestore.RowSource & strFilename
- strFile = Dir()
- If strFile <> "" Then lstRestore.RowSource = lstRestore.RowSource & ";"
- End If
- Loop
- lstRestore.Value = Null
All help is appreciated,
NDayave