View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default create a mdb databse and a table and add records from Excel VBA

bhellsun wrote:
I have created a database which has 9 tables. In the same way I have
an excel sheet which has 9 sheets. Exporting from excel to access
works fine using VBA. But my problem is i need to write this code in
each and every sheet. And I have used 9 buttons in excel to upload
the data in to the database.
This is the code I used in VBA.


IS THERE A WAY WHERE I CAN UPDATE THE COMPLETE 9 SHEETS TO THE
RESPECTIVE TABLES IN ACCESS IN A SINGLE CLICK.


No need to shout, I'm right here. Are all of your sheets set up the same?
What is the relationship between the sheet's names and the table's names?
Basically, you loop through all the sheets and inside the loop you add the
records. If your sheet names are the same as your table names, you can
substitute the sheet name for the table name in your sql statement. If not,
you may want an array that holds that info.

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com