Open a File

G

gr

Hi all,

I have a Listbox which displays all the files in a Folder.
I want to let the user select a file from the list and
after clicking a command button open the selected file.

I found some help in MS Access but not working.. my code
is:

Private Sub cmdOpenSavedReports_Click()
Dim lst As ListBox
Dim strFile As String
Dim fs, f
Set lst = Me.LstReports
strFile = "I:\Access Dbases\Service\Reports\"
strFile = strFile & lst.Value
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(strFile)
f.Close
End Sub

No error is displayed, but no file is opened..
any ideas?
thx.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top