Hi Everyone,
í'm trying to create a module that verify if the Filename that is created in Excel have a record. IF this filename in Excel doesn't have a record, the module will not transfer any information and it will display a MSG saying that there are no records to transfer. Well. in Access 2003 its works fine but in Access 2007 its not working!!! can some one please help me out on this one.
Thanks in Advance
HERE IS THE CODE.
Function LOADSHEET_LOADACCESS()
On Error GoTo LOADSHEET_LOADACCESS_Err
Set FS = Application.FileSearch
With FS
.LookIn = "S:\DIV_PLN\DIV_SAUX\"
.SearchSubFolders = True
.filename = "MatriculaMerge.xls"
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(i){commented out}
school = .FoundFiles(i)
DoCmd.TransferSpreadsheet acImport, 8, "TABLAMAT2008", school, True, "Sheet2!A1
30000"
Next i
Else
MsgBox "There were no files found."
End If
End With
LOADSHEET_LOADACCESS_Exit:
Exit Function
LOADSHEET_LOADACCESS_Err:
MsgBox Error$
' Resume LOADSHEET_LOADACCESS_Exit
End Function
í'm trying to create a module that verify if the Filename that is created in Excel have a record. IF this filename in Excel doesn't have a record, the module will not transfer any information and it will display a MSG saying that there are no records to transfer. Well. in Access 2003 its works fine but in Access 2007 its not working!!! can some one please help me out on this one.
Thanks in Advance
HERE IS THE CODE.
Function LOADSHEET_LOADACCESS()
On Error GoTo LOADSHEET_LOADACCESS_Err
Set FS = Application.FileSearch
With FS
.LookIn = "S:\DIV_PLN\DIV_SAUX\"
.SearchSubFolders = True
.filename = "MatriculaMerge.xls"
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(i){commented out}
school = .FoundFiles(i)
DoCmd.TransferSpreadsheet acImport, 8, "TABLAMAT2008", school, True, "Sheet2!A1
Next i
Else
MsgBox "There were no files found."
End If
End With
LOADSHEET_LOADACCESS_Exit:
Exit Function
LOADSHEET_LOADACCESS_Err:
MsgBox Error$
' Resume LOADSHEET_LOADACCESS_Exit
End Function