Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Create an access application sourced from SQL stored procs to create 3 different files

Posted on 2011-09-02
Medium Priority
Last Modified: 2012-05-12

the reason I have asked the whole is in case i can avoid any common pitfalls.. and will break this down into multiple q's if i have too.

I would like to have a form with a combobox in Access 2000 or Access 2003 which will display the names of the stored procedures I (or a user) have access to in my SQL 2005/2008 database.
Most likely be making this into an an MDE file. This would be distributed to around 5 users.

Once I have selected a stored procedure it will dynamically create additional comboboxes below, depending on how many and listing the with the optional parameters that I have specified in my stored procedure.

Once I have selected the parameters, I want to be able to choose

from radiobuttons

- Excel file then when clicking on a 'OK' button  this would export the results to a new .xls file that I would specify in the destination txtbox

- Access Database then when clicking on a 'OK' button  this would export the results to a new table in an .mdb file that I would specify in the destination txtbox

- Excel Pivot Table, this would allow additional form elements to be created allowing me to assign any of the fields returned by the stored procedure e.g.
Category1 to Page field
Category2 To Row Field
Category3 To Row field
Category4 to Column Field

And then I could choose a the data field and an aggregate function
e.g Count, SUM etc but more specifically Count UNIQUE that i could sent to the data area.

Then I could specify the destination xls file in a textbox then when clicking on a 'OK' button  this would create the new .xls file  that I would specify in the destination txtbox

any errors would end the procedure and write to a text file for debugging.

Is this asking to much? I realise the 1% inspiration 99% perspiration might very much apply to this.
Question by:Jimmy_inc
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 40

Assisted Solution

lcohan earned 500 total points
ID: 36474771
Why so complicated if you have SQL server I asumme you have SSRS so just use it and create reports based on your SQL stored procs record sets. The reports have a nice feature to export files in many different formats as well.
LVL 50

Assisted Solution

Lowfatspread earned 500 total points
ID: 36474861
and your question is?

The site is for answering questions/ giving guidance/advice
rather than having someone write applications for you....

you need to design you own tables to store the names of the stored procedures/ processes that
you will allow the users to execute, and define the parameter information that each will require...

... from a practical point of view you are likely to have procedures that you will not want the users to
execute directly (think sub functions...) but that from a pure database view point they could (will execute in the background) run.

LVL 42

Accepted Solution

dqmq earned 500 total points
ID: 36475011
The quick and dirty way is to design your app based on a few tables, for example, one to hold the names of procedures and a child table to hold the parameters needed by each procedure. Undoubtedly, more tables would be required, for example if each user has access to a different mix of procs.  

Then you dynamically "build" your form from that.  I do advise you that you cannot add controls to a form whilst the form is running--you must switch it to design mode, first. So to accomplish what you want, you either need a two-form model (form A builds and run form B) or a single form model with pre-defined controls that you hide/unhide as needed.

As your application matures, you may be able to replace some of the tables with views or procs that take advantage of SQL Server management views to retrieve proc names and parameter information from SQL Server's system tables.    

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 50

Expert Comment

ID: 36475360
i'd advise against using the internal management views directly use them as a base for your own
tables... that way you minimise you dependance on a specific version of sql server...
LVL 26

Assisted Solution

Nick67 earned 500 total points
ID: 36475796
You could do this, but it would be very complex.
You need to ask yourself at the outset if it would be beyond your skillset.
You can look at my article about staging data here
When you first combobox is selected, you could use code to populate a 'temp' table with rows to capture the users input for each needful parameter
(Alternatively, you could pre-build that table if nothing in the sprocs changes  Give each sproc an 'ID' number and filter with result from the table accordingly.)
By binding to a table, you can use a continuous form and get away from bazillions of unbound controls or dynamically building a form.
After the combobox selection is made, the form requeries.
The user makes selections and hits a command button to carry out the actions.
The sprocs can be executed by passthrough queries, and as such, bound to subforms or used by Recordsets and dispatched by VBA code.

It's doable--but highly complex--and given that you are asking the question it will involve a VERY steep learning curve for you
You are looking at making sense of my article
Automating Excel
Creating Pass-through queries
Dynamically rewriting a passthrough query through VBA Querydef
Using a pass-through as the basis for a recordset
Make-table SQL statements
Automating Access to get a new mdb going

and that's not even touching Pivot.

Deep man, deep.

Author Comment

ID: 36486796
Thanks for all the advice.

I will either use SSRS or

The quick and dirty way based on a few tables

I will use pass through queries to exec the sprocs

After the combobox selection is made, the form requeries.

and then the following should help:


again thanks all for your avice it will save me hours of time.

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question