-
1
- #1
Hi, with many thanks to a post by Rollie a while back I was finally able to complete this and thought I'd pass it along:
How to change a combo box row source to list .pdf files in a directory and then open those .pdf files.
1. Create combo box. In this case it is named CboFiles. Leave RowSource blank. Change Rowsource type to Value. Don't forget to set a field width.
Bound Column = 1
2. In the combo Box OnEnter Event, paste the following:
Dim MyFile As String, Stsql As String
MyFile = Dir("C:\PDFs\Mech\*.*"
Stsql = MyFile & ";"
Do While Not (MyFile = ""
MyFile = Dir
Stsql = Stsql & MyFile & ";"
Loop
Me.CboFiles.RowSource = Stsql
2. Paste the following into the combo box AfterUpdate Event:
FollowHyperlink "C:\Pdfs\Mech\" & Me.CboFiles
Hope that helps someone out.
How to change a combo box row source to list .pdf files in a directory and then open those .pdf files.
1. Create combo box. In this case it is named CboFiles. Leave RowSource blank. Change Rowsource type to Value. Don't forget to set a field width.
Bound Column = 1
2. In the combo Box OnEnter Event, paste the following:
Dim MyFile As String, Stsql As String
MyFile = Dir("C:\PDFs\Mech\*.*"
Stsql = MyFile & ";"
Do While Not (MyFile = ""
MyFile = Dir
Stsql = Stsql & MyFile & ";"
Loop
Me.CboFiles.RowSource = Stsql
2. Paste the following into the combo box AfterUpdate Event:
FollowHyperlink "C:\Pdfs\Mech\" & Me.CboFiles
Hope that helps someone out.