C
Chris Gorham
Hi,
I'm trying to import an excel s/sheet using the following code:
Set xlObj = CreateObject("excel.application")
xlObj.Visible = True
directory = xlObj.Application.GetOpenFilename("Excel Files (*.XLS), *.XLS", 1)
If directory = False Then Exit Sub
filecheck = Dir(directory)
xlObj.Quit
Set xlObj = Nothing
If filecheck <> file_name & ".xls" Then
check = MsgBox(prompt:="You have imported a file NOT titled: " & file_name
& ".xls" & Chr(13) & Chr(13) & "Please try again.", title:="WARNING!!")
GoTo jump
End If
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, file_name,
directory, -1
where filename is a variable containing the name of the file I want to import.
I then perform a series of test on the fields including their type.
One of the fields is contains dates, but although I can test for whether
this field has been imported ain date format:
If rs.Fields(3).Type <> 8 Then i = 3: Err.Number = 1002: GoTo errhandler
Access generate a type conversion failure table for when I have an imported
date of 00/00/0000
How can I test for when these type conversion failure tables are going to be
created so that I can block the s/sheet from being imported...??
Chris
I'm trying to import an excel s/sheet using the following code:
Set xlObj = CreateObject("excel.application")
xlObj.Visible = True
directory = xlObj.Application.GetOpenFilename("Excel Files (*.XLS), *.XLS", 1)
If directory = False Then Exit Sub
filecheck = Dir(directory)
xlObj.Quit
Set xlObj = Nothing
If filecheck <> file_name & ".xls" Then
check = MsgBox(prompt:="You have imported a file NOT titled: " & file_name
& ".xls" & Chr(13) & Chr(13) & "Please try again.", title:="WARNING!!")
GoTo jump
End If
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, file_name,
directory, -1
where filename is a variable containing the name of the file I want to import.
I then perform a series of test on the fields including their type.
One of the fields is contains dates, but although I can test for whether
this field has been imported ain date format:
If rs.Fields(3).Type <> 8 Then i = 3: Err.Number = 1002: GoTo errhandler
Access generate a type conversion failure table for when I have an imported
date of 00/00/0000
How can I test for when these type conversion failure tables are going to be
created so that I can block the s/sheet from being imported...??
Chris