4 Replies - 3685 Views - Last Post: 24 December 2011 - 10:53 AM Rate Topic: -----

#1 hwkong1688  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 30-September 11

how to write the code for import excel data to access database(mdb)?

Posted 23 December 2011 - 05:54 AM

Hi,
how to write the vb6 code for import data from excel to my database(mdb),im using data control to connect the database in vb6.
(example:vb6 form1, button1 for browse the excel file(xls) and button2 for import excel data to my database file(mdb))


your help is much appreciated,Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: how to write the code for import excel data to access database(mdb)?

#2 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 805
  • Joined: 16-September 09

Re: how to write the code for import excel data to access database(mdb)?

Posted 23 December 2011 - 11:20 AM

There are a couple of ways to go about this -- personally -- to save time and effort I recommend

docmd.transferspreadsheet acimport, , , , 



That would be if you're writing the vb in an access based module (the access vbe) otherwise, you would select the xls as a db and go row by row, you could open it as a program and parse the data or you could open access with controls from vb6, then use something like

dim AccApp as New Access.Application

'Once you've set it all up and put the pointers in the right locations, try

AccApp.Docmd.TransferSpreadSheet acimport , , , 



That's just my two cents :)
Was This Post Helpful? 0
  • +
  • -

#3 hwkong1688  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 30-September 11

Re: how to write the code for import excel data to access database(mdb)?

Posted 23 December 2011 - 05:43 PM

thank for your reply and info,im new in vb6 can you provide me some simple example code for my reference? i want import all excel data to my database access when i click the commandbutton, and another problem my client computer don't have a Microsoft access.

Thank you.
Was This Post Helpful? 0
  • +
  • -

#4 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 179
  • Posts: 1,599
  • Joined: 17-April 07

Re: how to write the code for import excel data to access database(mdb)?

Posted 24 December 2011 - 07:40 AM

if yuou use the search bar on top this forum you will get lot of links
Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,979
  • Joined: 19-May 09

Re: how to write the code for import excel data to access database(mdb)?

Posted 24 December 2011 - 10:53 AM

View Posthwkong1688, on 24 December 2011 - 12:43 AM, said:

thank for your reply and info,im new in vb6 can you provide me some simple example code for my reference? i want import all excel data to my database access when i click the commandbutton, and another problem my client computer don't have a Microsoft access.

Thank you.

Um...guyfromri just gave you some "simple example code" for your reference.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1