I have a form that pulls directory and file info so users can open pdf files. I have a list box that gives the sub directories, month year data i.e. "aug03, dec04". Once a user clicks on a choice, they click on a combo box that should list the files. I had this working by hand adding each directory into a table by hand, but I am trying to automate it. I have successfully added code to read the directories:
Private Sub List18_Enter()
Dim myDir1 As String, Str1 As String
List18.RowSourceType = "Value List"
myDir1 = Dir(path & "*.*", vbDirectory)
Str1 = ""
Do While Not (myDir1 = "")
If myDir1 <> "." And myDir1 <> ".." Then
If (GetAttr(path & myDir1) And vbDirectory) = vbDirectory Then
Str1 = Str1 & myDir1 & ";"
End If
End If
myDir1 = Dir
Loop
List18.RowSource = Str1
End Sub
The problem I am having is that now the combobox doesn't update. this is the new code for it:
Private Sub Combo14_Enter()
Dim Myfile As String, StSql As String
Combo14.RowSourceType = "Value List"
Myfile = Dir(path & Me.List18.Value & "\*.pdf")
StSql = Myfile & ";"
Do While Not (Myfile = "")
Myfile = Dir
StSql = StSql & Myfile & ";"
Loop
Me.Combo14.RowSource = StSql
End Sub
I don't get any data now, and I do not understand why. Any suggestions would be appreciated.
Thanks, Ken.
- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
Private Sub List18_Enter()
Dim myDir1 As String, Str1 As String
List18.RowSourceType = "Value List"
myDir1 = Dir(path & "*.*", vbDirectory)
Str1 = ""
Do While Not (myDir1 = "")
If myDir1 <> "." And myDir1 <> ".." Then
If (GetAttr(path & myDir1) And vbDirectory) = vbDirectory Then
Str1 = Str1 & myDir1 & ";"
End If
End If
myDir1 = Dir
Loop
List18.RowSource = Str1
End Sub
The problem I am having is that now the combobox doesn't update. this is the new code for it:
Private Sub Combo14_Enter()
Dim Myfile As String, StSql As String
Combo14.RowSourceType = "Value List"
Myfile = Dir(path & Me.List18.Value & "\*.pdf")
StSql = Myfile & ";"
Do While Not (Myfile = "")
Myfile = Dir
StSql = StSql & Myfile & ";"
Loop
Me.Combo14.RowSource = StSql
End Sub
I don't get any data now, and I do not understand why. Any suggestions would be appreciated.
Thanks, Ken.
- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg