What i have is a button that will automatically seach for an .xls file with a specific number from a text box 'SerialNumber' and display the reuslt in the seperate box 'results_dsiplay'.
currently i have only been able to specifically seach in a specified folder which i input in the form 'Month' & 'Year'
\\Server1\Results is my location to search which has sub folders of \year and \month
---------------------------------------
Private Sub resultsSEARCH_Click()
Dim i As Integer
Dim Coll_Docs As New Collection
Dim sMonth, sYear, Search_path, Search_Filter, Search_Fullname As String
Dim DocName As String
Search_path = "\\Server1\Results" ' where ?
Search_Filter = SerialNumber ' what ?
sMonth = Month
sYear = Year
Set Coll_Docs = Nothing
DocName = Dir(Search_path & "" & sYear & "" & sMonth & "" & Search_Filter & " *.xls")
Do Until DocName = "" ' build the collection
Coll_Docs.Add Item:=DocName
DocName = Dir
Loop
ATE_Results_Display = ""
If Coll_Docs.Count > 0 Then
'Tell user how many
ATE_Results_Display = "There were " & Coll_Docs.Count & _
" file(s) found." & vbCrLf & vbCrLf
'Load File Names into a ReDimensioning Array for every File Found
ReDim strFileNames(1 To Coll_Docs.Count)
'Tell User their Files Names
For i = 1 To Coll_Docs.Count
strFileNames(i) = Coll_Docs(i)
'Call Shell("explorer.exe ", Search_path, strFileNames, vbNormalFocus)
Results_Display = Results_Display & strFileNames(i) & vbCrLf
Next i
Else
'If no Files found, tell user
MsgBox "There were no files found."
End If
End Sub
-------------------------------------------
hope this makes sense