Access/VBA

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

Guest

I have a sub routine that is called from a form that imports a spreadsheet
and adds the records to an existing table. Each time I import a spreadsheet
to the table I need to count how many records were imported. I was able to
do this by creating a dup table to hold just the new records and then run a
query on this table to count the records. Isn't there a better way to do
this in a sub routine?
 
I have a sub routine that is called from a form that imports a spreadsheet
and adds the records to an existing table. Each time I import a spreadsheet
to the table I need to count how many records were imported. I was ableto
do this by creating a dup table to hold just the new records and then run a
query on this table to count the records. Isn't there a better way to do
this in a sub routine?

There's no need for an additional table here. In your event procedure,
I suggest you call the DCount function once before importing the
records, store the count in a variable, and call it once again after
the import finishes. Then you can just subtract the first count from
the second.
 
I have a sub routine that is called from a form that imports a spreadsheet
and adds the records to an existing table. Each time I import a spreadsheet
to the table I need to count how many records were imported. I was able to
do this by creating a dup table to hold just the new records and then run a
query on this table to count the records. Isn't there a better way to do
this in a sub routine?

I'd suggest linking (rather than importing) the spreadsheet; counting
the records just with DCount; and running an Append query.

John W. Vinson[MVP]
 
thank you for your suggestion. I just couldn't think this thru clearly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top