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

Posted on 2011-09-02
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 125 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 125 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 125 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.    
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 125 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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL 2012 Report Builder 3.0 query 2 15
SQL Server Pivot 5 35
Creating Scalar Function 3 14
Format Control on two Buttons 6 19
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
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…

739 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