I have a pop-up form (that opens up from frmOrderInput) with a listbox on it (lstCI) and it displays documents that relate to the value in field 'OrderID' (which is the Order number).
My code (as seen below) was originally written using a constant path to view the documents
Const cPath = "S:\Internal Sales\DatabaseFiles\OrderRelated\"
Dim sPath As String
Dim sFileList As String
Dim sFileName As String
sFileList = ""
sFileName = Dir(cPath)
Do While sFileName <> ""
If sFileName Like Forms!frmOrderInput!OrderID & "CI*" & "*" Then
sFileList = sFileList & sFileName & ";"
End If
sFileName = Dir
Loop
Me.lstCI.RowSource = sFileList
Me.lstCI.Requery
However, due to performance issues (with the high number of files in "S:\Internal Sales\DatabaseFiles\OrderRelated\" directory)
i have been forced to redesign the system & create subfolders on my server that hold documents ranging from one Order number to another...e.g "S:\Internal Sales\DatabaseFiles\OrderRelated\45000-47500" rather than in main folder
i understand that a constant is exactly that, a constant, however i need to change this code so the path is now variable and so that the listbox is capable of pointing towards the required file in the correct subfolder.
I hope i haven't confused anyone, can anyone help me re-code this??
My code (as seen below) was originally written using a constant path to view the documents
Const cPath = "S:\Internal Sales\DatabaseFiles\OrderRelated\"
Dim sPath As String
Dim sFileList As String
Dim sFileName As String
sFileList = ""
sFileName = Dir(cPath)
Do While sFileName <> ""
If sFileName Like Forms!frmOrderInput!OrderID & "CI*" & "*" Then
sFileList = sFileList & sFileName & ";"
End If
sFileName = Dir
Loop
Me.lstCI.RowSource = sFileList
Me.lstCI.Requery
However, due to performance issues (with the high number of files in "S:\Internal Sales\DatabaseFiles\OrderRelated\" directory)
i have been forced to redesign the system & create subfolders on my server that hold documents ranging from one Order number to another...e.g "S:\Internal Sales\DatabaseFiles\OrderRelated\45000-47500" rather than in main folder
i understand that a constant is exactly that, a constant, however i need to change this code so the path is now variable and so that the listbox is capable of pointing towards the required file in the correct subfolder.
I hope i haven't confused anyone, can anyone help me re-code this??