Using Excel as front end to Access database (with VBA)

前端 未结 12 2113
我在风中等你
我在风中等你 2021-01-30 17:42

I am building a small application for a friend and they\'d like to be able to use Excel as the front end. (the UI will basically be userforms in Excel). They have a bunch of dat

相关标签:
12条回答
  • 2021-01-30 18:02

    It Depends how much functionality you are expecting by Excel<->Acess solution. In many cases where you don't have budget to get a complete application solution, these little utilities does work. If the Scope of project is limited then I would go for this solution, because excel does give you flexibility to design spreadsheets as in accordance to your needs and then you may use those predesigned sheets for users to use. Designing a spreadsheet like form in Access is more time consuming and difficult and does requires some ActiveX. It object might not only handling data but presenting in spreadsheet like formates then this solution should works with limited scope.

    0 讨论(0)
  • 2021-01-30 18:03

    If the end user has Access, it might be easier to develop the whole thing in Access. Access has some WYSIWYG form design tools built-in.

    0 讨论(0)
  • 2021-01-30 18:05

    It really depends on the application. For a normal project, I would recommend using only Access, but sometimes, the needs are specific and an Excel spreadsheet might be more appropriate.

    For instance, in a project I had to develop for a former employer, the need was to give access to different persons on forms(pre-filled with some data, different for each person) and have them complete them, then re-import the data.

    Since the form was using heavy number crunching, it made more sense to build it in Excel.

    The Excel workbooks for the different persons were built from a template using VBA, then saved in a proper location, with the access rights on the folder.

    All workbooks were attached as External tables to the workbooks, using named ranges. I could then query the workbooks from the Access Application. All administrative stuff was made from the db, but the end users only had access to their respective workbook.

    Developping an Excel/Access application this way was a pleasant experience and the UI was more user-friendly than it would have been using Access.

    I have to say that in this case, it would have taken a lot more time doing it in Access than it took using Excel. Also, the Application Object Model seems better though in Excel than in Access.

    If you plan to use Excel as a front-end, do not forget to lock all the cells, but the editable ones and don't be affraid to use masked rows and columnns (to construct output tables for the access database, to perform intermediate calculations, etc).

    You should also turn off autocalculation while importing data.

    0 讨论(0)
  • 2021-01-30 18:05

    I did it in one project of mine. I used MDB to store the data about bills and used Excel to render them, giving the user the possibility to adapt it.

    In this case the best solution is:

    1. Not to use any ADO/DAO in Excel. I implemented everything as public functions in MDB modules and called them directly from Excel. You can return even complex data objects, like arrays of strings etc by calling MDB functions with necessary arguments. This is similar to client/server architecture of modern web applications: you web application just does the rendering and user interaction, database and middle tier is then on the server side.

    2. Use Excel forms for user interaction and for data visualisation.

    3. I usually have a very last sheet with some names regions for settings: the path to MDB files, some settings (current user, password if needed etc.) -- so you can easily adapt your Excel implementation to different location of you "back-end" data.

    0 讨论(0)
  • 2021-01-30 18:06

    You could try something like XLLoop. This lets you implement excel functions (UDFs) on an external server (server implementations in many different languages are provided).

    For example you could use a MySQL database and Apache web server and then write the functions in PHP to serve up the data to your users.

    BTW, I work on the project so let me know if you have any questions.

    0 讨论(0)
  • 2021-01-30 18:08

    Unless there is a strong advantage to running your user form in Excel then I would go with a 100% Access solution that would export the reports and data to Excel on an ad-hoc basis.

    From what you describe, Access seems the stronger contender as it is built for working with data:
    you would have a lot more tools at your disposal to solve any data problems than have to go around the limitations of Excel and shoehorn it into becoming Access...

    As for your questions:

    1. Very easy. There have been some other questions on SO on that subject.
      See for instance this one and that one.

    2. Don't know, but I would guess that there could be a small penalty.
      The biggest difficulty I see is trying to get all the functionalities that Access gives you and re-creating some of these in Excel.

    3. Yes, you can have multiple Excel users and a single Access database.
      Here again, using Access as a front-end and keeping the data in a linked Access database on your network would make more sense and it's easy as pie, there's even a wizard in Access to help you do that: it's just 1 click away.

    Really, as most other people have said, take a tiny bit of time to get acquainted with Access, it will save you a lot of time and trouble.
    You may know Excel better but if you've gone 80% of the way already if you know VBA and are familiar with the Office object model.

    Other advantages of doing it in Access: the Access 2007 runtime is free, meaning that if you were to deploy to app to 1 or 30 PC it would cost you the same: nothing.
    You only need one full version of Access for your development work (the Runtime doesn't have the designers).

    0 讨论(0)
提交回复
热议问题