Import Excel sheets into Access

N

Neo

Hi all,

I have Database with one table. I have a form with single command
button. I have written a code in the click event of command button for
importing excel sheets into the database. My code used FileDialog
object to open the filepicker and select the excel sheet as per user
requirement. The import works successfully. The excel sheets data are
imported into the main table.

Constaint 1:
The main table contains 10 fields and the excel sheet contains only 6
fields. So after importing the excel sheets i should provide the user
an interface to update the remaining 4 fields manually. Assume the
excel sheet contains some 100 entries...
so how can i do this without opening the table itself using
'Docmd.opentable' command
i dont want the user to edit the maintable directly ...
Please give me an approach to achieve this task...

Constraint 2:
I want to check each entry (each row of excel contains a record) of
excel sheet whether it is already existing in the table before
importing those into the Maintable. Otherwise it results in duplication
of record. So i planned to import the excel sheets into a Temporary
table and then compare the Primary key (in my case the field named "ID"
acts as a unique reference to each record) with the Main Table. If any
match found(the entry already exists), then discard that particular
record and copy the rest of the records from temporary table to main
table.
Delete the entries of Temporary table, so that it is ready for next
import operation.
Is this approach possible using VBA and if yes can someone please
help me out. Please guide me to achieve this task...
Or Please mention an alternate approach for the same task..

Thanks in advance
Neo
 
D

David

What about just "linking" the spreadsheet just like a table and process
similar to an Access table? Also, why in the world would you use
DoCmd.OpenTable ? Use VBA code to open the database and recordset and read
through it.

David
 

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

Top