ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExitEnd SubThe “Import Text Type” option group’s event procedure first checks that the selected text file is the
right type, and clears it if not, then sets up a Select Casestatement to process comma-delimited
and text files differently, calling the SaveTextFileSub:
Private Sub fraTextType_AfterUpdate()On Error GoTo ErrorHandlerDim strExt As StringCheck that the selected text file is the right type, and clear the file selection if not.
intTextType = Nz(Me![fraTextType].Value, 1)
strTextFile = GetTextFile()If Len(strTextFile) > 4 Then
strExt = Right(strTextFile, 3)
End IfSelect Case intTextTypeCase 1Comma-delimited
If strExt = “txt” Then
SaveTextFile (“”)
Me![txtSelectedTextFile].Value = “”
End IfCase 2Fixed-width
If strExt = “csv” Then
SaveTextFile (“”)
Me![txtSelectedTextFile].Value = “”
End IfCase 3
If strExt <> “csv” And strExt <> “txt” Then
SaveTextFile (“”)
Me![txtSelectedTextFile].Value = “”
End IfWorking with External Data 10