Import Excel records to Access using a VB .Net frontend

T

Tony A.

I would like to import records from Excel to an Access DB using a VB .Net
frontend. I thought about creating an Access macro to do the import, and
then run the macro from the VB >Net application, but I'm how to do this or if
it can be done. Any suggestions? Thanks...
 
S

Sivakumar O. K.

One approach is to write a module in MS Access which reads the excel and then
insert the records into the MS Access table. Then the module function can be
invoked from VB.Net application.

The code to invoke Access macro / module is given below.

Dim AccessObject As Object
'Get the MS Access application instance
AccessObject = CreateObject("Access.Application")
'Open the database
AccessObject.OpenCurrentDatabase("C:\db_macro.mdb")
'Hide the application instance
AccessObject.visible = False

'Invoking a module
'AccessObject.Run("module")

'Invoke the access macro
AccessObject.DoCmd.RunMacro("table_save")
'Close the database
AccessObject.CloseCurrentDatabase()
'Quit the instance
AccessObject.Quit()
AccessObject = Nothing
 

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