473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Changing Stored Procedures

Hi,

I'm trying to build a dynamic query by form. The idea is that a user can select a table in the database via a combo box and this will then change all of the text box labels on the form to match the field headers for the selected table. It also hides any text boxes that are surplus to the number of fields of the selected table.

The user can then add their search criteria into the text boxes and search the selected table. To achieve this I've written some VBA that changes a stored procedure so that it fires off the correct SQL for the users search. The code works fine but I'm getting errors when trying to open the Stored Procedure.

The first error I encountered was after running the stored procedure for the first time which worked fine. When I selected a new table and ran a new search the old tables columns are displayed but blank.

When opening the procedure in design view the SQL was correct so I saved the procedure (without changing any settings) and ran it again. This time it displayed the correct data. So the SQL is being generated correctly by the VBA but the stored procedure isn't updating properly.

To try and solve this so far I have tried:

Opening the procedure (via VBA) saving and closing it and then opening it again in normal view. This produced the same error.

Changing the SQL in my code from an Alter Procedure to a Create Procedure and deleting the previous Procedure each time the code is run. This produced a new error in that every time the code was run Access would lose the procedure when it came to trying to open it. It magically reappears after closing and reopening the .adp

The database is built in Access Project (.adp) by the way.

Any help you can give me would be greatly appreciated.

Darkside
Dec 16 '08 #1
3 1568
Hi Again,

I solved the issues by closing and reopening the connection to SQL Server which refreshes the stored procedures.

Darkside
Dec 17 '08 #2
Have you considered using:
select * from information_schema.tables and
select * from information_schema.columns as the control source of your controls?

You can bind your controls to these 2 views and get all the info you need without the overhead of closing & reopening your connections..
Dec 17 '08 #3
It wasn't so much getting to the column headers rather than updating the stored procedures themselves. The SQL in the proceudres ran correctly after opening them in design view and saving them.

Rather than having to do that each time a user wants to run the procedure closing and reopening the connection to SQL Server automatically updates everything in the .adp

If it took a while I would have been tempted to carry on searching for a different solution but it doesn't even take a second.
Dec 17 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: M Wells | last post by:
Hi All, I'm wondering if anyone can tell me if it's possible to search for stored procedures by their contents? I tend to leave very descriptive notes in stored procedures and they're...
11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
2
by: scott | last post by:
Hi, Just wondering what sort of problems and advantages people have found using stored procedures. I have an app developed in VB6 & VB.NET and our developers are starting to re-write some of the...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
11
by: peter | last post by:
I am trying to get a SQL stored procedure to use user maintained MQT implicitly which raises questions on when they are used or not used. In theory you would expect the stored procedure to pick up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.