+ Reply to Thread
Results 1 to 17 of 17

64 Bit Excel, VBA with Access database

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    204

    64 Bit Excel, VBA with Access database

    I have a huge Excel workbook application containing lots of data that can actually go into a database.

    I was thinking of making an Access Database with a few tables that can hold such data, transfer the data to the database tables and then whenever data is needed go and read it from the database instead of finding it in the different worksheets.

    It's Excel 64Bit with VBA that must access the database.

    Any pointers to a good reference that can give me an example of what needs to be referenced in VBA, how to create the connection, how to create a recordset etc.

    I have no experience with accessing a database from VBA code.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: 64 Bit Excel, VBA with Access database

    If you Google 'importing excel into access 2010 using vba' you will find all the information you need
    From there on ... we may be able to help.
    Try and let us know
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    204

    Re: 64 Bit Excel, VBA with Access database

    My problem is the way some of that data is represented in the worksheets. There will be no way to just import the data.

    I will have to create a database. Then connect to it and loop the data importing each piece of data into the database.

    I have looked at some examples I found googling but for instance...

    Please Login or Register  to view this content.
    What does this mean? It doesn't show how to get to this. Where is the connection made etc.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: 64 Bit Excel, VBA with Access database

    First step is make the data in the worksheets loom like a database table
    Alternative is to create an Excel table (ListObject) of the data that works almost like an Access table.
    This you can export to a new database.
    I am not Access specialist, I leave that to others, I am just trying to point you in a direction I think might help you.
    I have no idea how your worksheet looks like but you should at least consolidate it to make it work as a table.

  5. #5
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Re: 64 Bit Excel, VBA with Access database

    Hi Bezzie,

    change your approach. First create access database, move your data and next read this trough Excel.

    Best,
    Jacek

  6. #6
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    204

    Re: 64 Bit Excel, VBA with Access database

    The data sits in worksheets. To get it into the database I need to open a database in VBA and import the data from the worksheets to the database using macros.

    As I said the data is not just records in the worksheet. For instance: Share prices worksheet has the shares listed in rows of the worksheet while the prices is listed in the columns. Each column has a date at the top and these columns run from 1/1/2014 up to today. That's over 1800 columns.

    Other worksheets e.g. accounts has few columns for each account and the data is in the rows down. But then there is multiple accounts spread over the columns on the same worksheet where some has few records and others has lots of records.

    Once I can open the database and read/write to it I think I will be able to do some macros that can read the data from the worksheets and write it to the database tables in the format needed in the tables.

    But before I can try this I need to get the database opened from within VBA.

    Some of the examples I found is VB. Will the VB code work in VBA? Keeping in mind it has to work in Excel 2010 64bit and most probably Office 365 (64Bit?) in the near future.

    I will have to experiment how to accomplish this but in order to try I need the database opened first. And that's where I'm stuck. The examples I did find all start something like this:
    Please Login or Register  to view this content.
    How does this piece of code know where and what the database is?

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Re: 64 Bit Excel, VBA with Access database

    Still i am thinking best is to manually copy all data from Excel to Access.

    And you can write queries in Access to do calculations. Afterall, you can connect to access and download specific queries.
    Writing into Access from Excel can cause a lot of issues with performance. I was experincing that...

    Best,
    Jacek

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: 64 Bit Excel, VBA with Access database

    Have you tried recording a macro and see what happens?
    You run the macro in Excel to open the database and then..
    Still my first idea is to consolidate the data as a table and THEN import it in Access.

  9. #9
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Re: 64 Bit Excel, VBA with Access database

    Exactly,

    first set up properly data in Excel, then export it to Access.
    Recording macro will not work.

    Best,
    Jacek

  10. #10
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    204

    Re: 64 Bit Excel, VBA with Access database

    For now lets forget how to get the data into the tables.

    For now I need help to setup the connection and open the database. If I can do that I can start to experiment on the rest.

  11. #11
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Re: 64 Bit Excel, VBA with Access database

    Please Login or Register  to view this content.
    try code similar like here to connect to database.

  12. #12
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    204

    Re: 64 Bit Excel, VBA with Access database

    Thanks. Will look into your example a little later. Got some other work I have to attend to now.

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: 64 Bit Excel, VBA with Access database

    The first thing you need to do is understand relational database design and normalisation. Only then should you look at importing data, your data is laid out incorrectly for a database and you need to transpose it.

  14. #14
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: 64 Bit Excel, VBA with Access database

    To learn about normalization that Kyle refers to: https://www.studytonight.com/dbms/da...malization.php
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  15. #15
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: 64 Bit Excel, VBA with Access database

    Thanks for sharing the link, I've got something to set my teeth into

  16. #16
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    204

    Re: 64 Bit Excel, VBA with Access database

    OK. Got the connection to the database working. Now need to learn getting the correct info from the data tables.

    Battling to get the correct dataset using dates

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: 64 Bit Excel, VBA with Access database

    Here is when you start on consolidating your data to get organized as a database (table)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. copy data from one access database to another access database
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2014, 09:03 AM
  2. Replies: 2
    Last Post: 05-10-2014, 06:58 PM
  3. change Access database to Excel database using VBA
    By zafirah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2013, 01:13 AM
  4. Replies: 2
    Last Post: 07-05-2013, 09:37 AM
  5. How to access MS Access DataBase from Excel programming in VBA
    By amitt.2202 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2010, 05:59 AM
  6. Excel query of Access database - changed database filename, now error
    By ucdcrush@gmail.com in forum Excel General
    Replies: 2
    Last Post: 03-08-2006, 04:45 PM
  7. Excel and Access database ?
    By SpookiePower in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2006, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1