How do I access the Import Errors Table? (1 Viewer)

darren99

New member
Local time
Today, 01:46
Joined
Jul 15, 2002
Messages
6
How do I automatically delete the import errors table when I import a table from an excel file using the transferspreadsheet action in VBA?

The problem is that the name of the table created is unpredictable because tablename generated = [name of worksheet from source file]_[ImportErrors]

All I would like to do is be able to access this table once it is created in VBA...

Any help would be really appreciated,
Thank you.
 

RV

Registered User.
Local time
Today, 01:46
Joined
Feb 8, 2002
Messages
1,115
Not in detail as this it not my kind of league.
But, can't you use DROP TABLE at the end of your code?
Store the name of the file you're importing from in a variable.
Use this variable to refer to the table to be dropped.

This is the most logical way to achieve your goal.

HTH,

RV
 

darren99

New member
Local time
Today, 01:46
Joined
Jul 15, 2002
Messages
6
Thanks for your help,

however, the problem is that the name of the excel worksheet imported is independent of the name of the file...

Do you know how I can access the name of the excel worksheet as to be able to access the import errors table? Or Do you know if there is a way to manually detect what recent tables have been created and be able to access them without knowing their names beforehand?

Thanks again.
 

PaulSpell

Registered User.
Local time
Today, 01:46
Joined
Apr 19, 2002
Messages
201
You could use something like this:

Dim errDb As Database
Dim errRec As TableDef

Set errDb = CurrentDb

For Each errRec In errDb.TableDefs
If (InStr(1, errRec.Name, "ImportErrors", vbTextCompare) > 0) Then
'if error table found do something with the table here
End If

Next errRec

Set errDb = Nothing
 

Users who are viewing this thread

Top Bottom