davidmunoz
MIS
I have the following VB script set in an event procedure for a button:
Private Sub Command5_Click()
Dim fs As Object
Dim i As Integer
Set fs = Application.FileSearch
With fs
.LookIn = "J:\USB_Requests\Original Requests"
.filename = "*.xls"
If .Execute() > 0 Then
MsgBox "File(s) found: " & .FoundFiles.Count
For i = 1 To .FoundFiles.Count
MsgBox "File found: " & .FoundFiles(i)
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "tbl_USB_Create_Request", .FoundFiles(i), True
Next i
Else
MsgBox "File(s) not found.", vbExclamation
End If
DoCmd.Requery "qry_USB_Create_Request subform"
DoCmd.GoToControl "qry_USB_Create_Request subform"
DoCmd.GoToControl "USB_Date_Submitted"
End With
End Sub
It works fine on an OS WIN95 running EXCEL and ACCESS from OFFICE97. But in OS WIN2K using the same MS OFFICE Programs it doesn't work. Anyone have a correction and reason why?
Private Sub Command5_Click()
Dim fs As Object
Dim i As Integer
Set fs = Application.FileSearch
With fs
.LookIn = "J:\USB_Requests\Original Requests"
.filename = "*.xls"
If .Execute() > 0 Then
MsgBox "File(s) found: " & .FoundFiles.Count
For i = 1 To .FoundFiles.Count
MsgBox "File found: " & .FoundFiles(i)
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "tbl_USB_Create_Request", .FoundFiles(i), True
Next i
Else
MsgBox "File(s) not found.", vbExclamation
End If
DoCmd.Requery "qry_USB_Create_Request subform"
DoCmd.GoToControl "qry_USB_Create_Request subform"
DoCmd.GoToControl "USB_Date_Submitted"
End With
End Sub
It works fine on an OS WIN95 running EXCEL and ACCESS from OFFICE97. But in OS WIN2K using the same MS OFFICE Programs it doesn't work. Anyone have a correction and reason why?