By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

import data and count number of new records in table - an example

P: n/a
No question here, just a procedure for the archive.
Search critera:
count records imported count data imported count number of rows
count number of records imported record import count automatically
and count records prompt for number of records imported import count
auto-import records
autoimport records count records before and after

Sub ImportDataAndCountNumberOfNewlyImportedRecords()

Dim NumRecordsBeforeImport As Double

NumRecordsBeforeImport = DCount("*",

'Example of calling the MS Access macro that auto-imports your
' DoCmd.RunMacro "mcrOpenImportSpecs&CountRecordsImported"

'Example of using the VBA TransferText method to auto-import your

DoCmd.TransferText acImportFixed, "MTVolumesImportSpec",
"tblImportMTVolumesDataIntoThisTable", "C:\Documents and
Settings\user\Desktop\Temp\Aug04Vols.txt", False
NumRecordsAferImport = DCount("*",
MsgBox NumRecordsBeforeImport & " records existed in the table
before the data import."
MsgBox "There are now " & DCount("*",
"tblImportMTVolumesDataIntoThisTable") & " total records after the

MsgBox DCount("*", "tblImportMTVolumesDataIntoThisTable") -
NumRecordsBeforeImport & " records were imported."

End Sub
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.