how to count how many files have been imported?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
How can i show the err message during import? sometimes when the format of
the .xls file that i want to import has the feld with different format as my
tartget table "TmoImportTable", it will not import the spreadsheet and there
is no err message shown also
..
In my code below, I want to show how many .xls files have been imported.
However i can only show how many files found in the directory that i want to
import from. How can i change it so that i may show actually how many files
have been imported into my database instead of showing how many files are
there to be imported.

If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
DoCmd.TransferSpreadsheet acImport, , "TmpImportTable", _
.FoundFiles(i), True
Next i
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
Else
MsgBox "There were no files found."
End If


Thanks...
 
Hi basara,

try this:

'~~~~~~~
Dim Mcount1 as long, mCount2 as long

mCount1 = currentdb.TableDefs.Count

'... other statements

currentdb.tabledefs.refresh
DoEvents

mCount2 = currentdb.TableDefs.Count

msgbox mCount2 - mCount1 & " tables added" _
,,"Done Importing"
'~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
Why aren't you getting any error messages? Are you trapping them? If you
are trapping them, then you could use a variable to accumulate the number of
errors that occur and subtract that from the FoundFiles.Count to return the
number imported.
 
Hi,

Thanks for the help, but what i want to do is to import the data entries
from a spreadsheet to a table in my database. Guess maybe i can count the
data entries in the table before and after the import. (though not sure of
how to do it yet.. :p )
 
Yo..

Problem solved. I use intX = DCount("*", "TmpImportTable") to count the
number of entries in the table before and after import.
Thanks for your idea.
 
that works too ;) you're welcome

Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
Back
Top