473,756 Members | 4,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding a SP in Access under Query, but retain Execute on SP

Hello,

Access XP, SQL Server 2000

Is it possible to hide a SP under Queries in Access, yet still be able
to Execute it from Access? (Similar to hiding Tables, then using
Views)

We hooked up a custom form to accept the input parameters (MS Feature
Request!) for the Stored Procedure. We had two problems with MS's
'Input Parameter' dialog: 1) We could not customize, 2) We continually
received a message from Access stating, "The stored procedure executed
successfully but did not return records" ('SET NOCOUNT ON' gave no
joy).

Below is the sample code we are using.
TestInsert is the SP
txtName is a text box on the form
@name is char(80)

Private Sub cmdAdd_Enter()

Dim cmd As New ADODB.Command
Dim par As Parameter

Set cmd.ActiveConne ction = CurrentProject. Connection

cmd.CommandText = "TestInsert "
cmd.CommandType = adCmdStoredProc

Set par = cmd.CreateParam eter("@name", adVarChar, _
adParamInput, Len(txtName), txtName)

cmd.Parameters. Append par

cmd.Execute

Set cmd = Nothing

End Sub

The trivial Stored Procedure looks as follows (and does not return any
records):

CREATE PROCEDURE TestInsert (@Name char(80))
AS SET NOCOUNT ON
INSERT INTO TestTable (Name)
VALUES (@Name)

Any help would be appreciated. We can't seem to find a good work
around here.

Thanks

Jeff
Jeffrey Walton
noloader
Nov 12 '05 #1
2 2036
no******@yahoo. com (Noloader) wrote in news:6b543aa7.0 405070700.1133b cc0
@posting.google .com:
Hello,

Access XP, SQL Server 2000

Is it possible to hide a SP under Queries in Access, yet still be able
to Execute it from Access? (Similar to hiding Tables, then using
Views)

We hooked up a custom form to accept the input parameters (MS Feature
Request!) for the Stored Procedure. We had two problems with MS's
'Input Parameter' dialog: 1) We could not customize, 2) We continually
received a message from Access stating, "The stored procedure executed
successfully but did not return records" ('SET NOCOUNT ON' gave no
joy).

Below is the sample code we are using.
TestInsert is the SP
txtName is a text box on the form
@name is char(80)

Private Sub cmdAdd_Enter()

Dim cmd As New ADODB.Command
Dim par As Parameter

Set cmd.ActiveConne ction = CurrentProject. Connection

cmd.CommandText = "TestInsert "
cmd.CommandType = adCmdStoredProc

Set par = cmd.CreateParam eter("@name", adVarChar, _
adParamInput, Len(txtName), txtName)

cmd.Parameters. Append par

cmd.Execute

Set cmd = Nothing

End Sub

The trivial Stored Procedure looks as follows (and does not return any
records):

CREATE PROCEDURE TestInsert (@Name char(80))
AS SET NOCOUNT ON
INSERT INTO TestTable (Name)
VALUES (@Name)

Any help would be appreciated. We can't seem to find a good work
around here.

Thanks

Jeff
Jeffrey Walton
noloader


Was the name inserted?
Typically SELECT statements return records while INSERT,DELETE and UPDATE
statements do not.
Your stored procedure takes a fixed length string [char(80)]. Why did you
send it a variable length parameter [adVarChar]?
In what way do you want to customize?
It's generally not a great idea use words like "Name", "Date" etc in
Databases. Munge them up somehow so that no technology confuses them with the
name property of some object.
In my largest table (375 298 467 records) I use "RedHeadNam e".
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
Lyle Fairfield <Mi************ @Invalid.Com> wrote in message news:<Xn******* ************@13 0.133.1.4>...
no******@yahoo. com (Noloader) wrote in news:6b543aa7.0 405070700.1133b cc0
@posting.google .com:
Hello,

Access XP, SQL Server 2000

Is it possible to hide a SP under Queries in Access, yet still be able
to Execute it from Access? (Similar to hiding Tables, then using
Views)

We hooked up a custom form to accept the input parameters (MS Feature
Request!) for the Stored Procedure. We had two problems with MS's
'Input Parameter' dialog: 1) We could not customize, 2) We continually
received a message from Access stating, "The stored procedure executed
successfully but did not return records" ('SET NOCOUNT ON' gave no
joy).

Below is the sample code we are using.
TestInsert is the SP
txtName is a text box on the form
@name is char(80)

Private Sub cmdAdd_Enter()

Dim cmd As New ADODB.Command
Dim par As Parameter

Set cmd.ActiveConne ction = CurrentProject. Connection

cmd.CommandText = "TestInsert "
cmd.CommandType = adCmdStoredProc

Set par = cmd.CreateParam eter("@name", adVarChar, _
adParamInput, Len(txtName), txtName)

cmd.Parameters. Append par

cmd.Execute

Set cmd = Nothing

End Sub

The trivial Stored Procedure looks as follows (and does not return any
records):

CREATE PROCEDURE TestInsert (@Name char(80))
AS SET NOCOUNT ON
INSERT INTO TestTable (Name)
VALUES (@Name)

Any help would be appreciated. We can't seem to find a good work
around here.

Thanks

Jeff
Jeffrey Walton
noloader
Was the name inserted?
Typically SELECT statements return records while INSERT,DELETE and UPDATE
statements do not.
Your stored procedure takes a fixed length string [char(80)]. Why did you
send it a variable length parameter [adVarChar]?
In what way do you want to customize?
It's generally not a great idea use words like "Name", "Date" etc in
Databases. Munge them up somehow so that no technology confuses them with the
name property of some object.
In my largest table (375 298 467 records) I use "RedHeadNam e".


Hi Lyle,
Was the name inserted? Yes
Typically SELECT statements return records while INSERT,DELETE
and UPDATE statements do not. Yes - we changed cmd.execute to the following to dispose of the
message box (apparently, Access needs a hint):
cmd.Execute , , adExecuteNoReco rds
In what way do you want to customize? Too many things to name - I suppose it is good from Access's point of
view, but very poor from a User Interface design stand point.
It's generally not a great idea use words like "Name",
"Date" etc in Databases.

We'll definetly use better naming conventions in production.

Thanks for the reply,
Jeffrey Walton
noloader
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2693
by: Les Juby | last post by:
I have a customer with an extensive intranet which contains a lot of sensitive company data. The client is concerned that any employee could download source code back to removable storage and thereby steal the data. Printing is considered publicly risky and other capture methods of visble screens would be too clumsy and outside the capability of most. So we have been asked to make the source "invisible" or at least extremely...
4
3515
by: Noloader | last post by:
Hello, Access XP, SQL Server 2000 Is it possible to hide a SP under Queries in Access, yet still be able to Execute it from Access? We hooked up a custom form to accept the input parameters (MS Feature Request!) for the Stored Procedure. We had two problems with MS's 'Input Parameter' dialog: 1) We could not customize, 2) We continually
1
2946
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David Cline: http://www.15seconds.com/issue/981216.htm
4
1717
by: shumaker | last post by:
I'm wondering how/why this query works. Trying to get my head wrapped around SQL. Basically the Query deletes from the Import table all records that are already in FooStrings so that when I do an insert from the FooStringsImport table into the FooStrings table, then I won't get primary key violations. DELETE FROM FooStringsImport WHERE EXISTS (SELECT * FROM FooStrings WHERE FooStringsImport.FooKey = FooStrings.FooKey)
4
2459
by: Ray | last post by:
Does anyone out there have experience with using Db2 8.2 with a program called MISys (also known as ACCPAC). I am having some problems with the application running exteremly slow on workstations throughout my office. One of the more accessed tables, which only has 3000 rows, take almost 30 seconds to open through their application. MISys insists that it is a db2 tweaking problem and to check my configuration settings. When I select the...
1
9778
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping to export two Tables (or queries...not sure which to use - they both seem to have the same data) in...
5
3899
by: HowardChr | last post by:
I have my program set up so that when a button called "Clear" is clicked, it clears all Yes/No fields from a seperate table. The problem is that when that button is clicked, it is coming up with 2 seperate message boxes making sure that is what they want to do. The first one says: "are you sure you want to run that query", and the second says "You are about to update 1 row". Is there a way to code this so those message boxes are either...
6
4404
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one field between them. The join field in both tables are indexed and I'm selecting 1 field from each table to lookup. The Access query is taking more than 60 second to retrieve 1 record and if I execute the same query within the Query Analyzer, it...
13
3733
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between !! And !! Not sure how to do so (should it be a query in Access or a macro) The connection would be ODBC.
1
9838
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.