Unanswered: Receiving an ImportError, and sending it as an Object
Not new to Access, but very very new to VBA.
I have a macro that imports a delimited text file, and on occasion there is a ImportError (because it contains invalid characters) and a table is created. I would like this database to recognize when this happens, and sends that Import ErrorTable as an object/email.
Can this be done within the macro, or is this going to require VBA?
[note] This database runs automatically using scheduler on a virtual machine, so a solution hopefully needs to be done without manual input.
After importing the file, you could use a function to test for the existence of the ImportError table and, if necessary, send it:
<Command to import the text file>
If TableExist("ImportError") Then
<Command to send the ImportError table by email>
Docmd.DeleteObject acTable, "ImportError "
Function TableExist(ByVal TableName As String) As Boolean
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If tdf.Name = TableName Then
TableExist = True
Set dbs = Nothing