I am importing an excel spreadsheet into an Access table using the following code:
Dim FiletoImport As String
Dim dbs As Database
Set dbs = CurrentDb
FiletoImport = "l:\HR Current.xls"
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="(SE)_tbl_HR_Data_Raw", Filename:=FiletoImport, hasfieldnames:=True, spreadsheettype:=5
it works fine but I need error handler for when the file is not yet in the right location i.e. the person using the db has not saved the file in the correct location but still tries to run the import. Furthermore I would like to change the file name to not be proceeded by the letter "l" but by a wilde card character in order for the db to work on other people's pc who might not have named their drive "l".
Thanks in advance...
Dim FiletoImport As String
Dim dbs As Database
Set dbs = CurrentDb
FiletoImport = "l:\HR Current.xls"
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="(SE)_tbl_HR_Data_Raw", Filename:=FiletoImport, hasfieldnames:=True, spreadsheettype:=5
it works fine but I need error handler for when the file is not yet in the right location i.e. the person using the db has not saved the file in the correct location but still tries to run the import. Furthermore I would like to change the file name to not be proceeded by the letter "l" but by a wilde card character in order for the db to work on other people's pc who might not have named their drive "l".
Thanks in advance...