473,765 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stored procedure in access

92 New Member
hi
is there any way to use sql stored procedure in access 2003?

i have a tored procedure that want to link it to access database but have no ided that it is possible or not?

thanks alot
Oct 16 '07 #1
4 1947
Jim Doherty
897 Recognized Expert Contributor
hi
is there any way to use sql stored procedure in access 2003?

i have a tored procedure that want to link it to access database but have no ided that it is possible or not?

thanks alot
Have a look at the .ADP Project file format in Access it is designed to work directly with stored procedures and SQL server side records exposing the stored procedures and view interface for manipulation on the client side.

Regards

Jim
Oct 16 '07 #2
Jim Doherty
897 Recognized Expert Contributor
Have a look at the .ADP Project file format in Access it is designed to work directly with stored procedures and SQL server side records exposing the stored procedures and view interface for manipulation on the client side.

Regards

Jim

If you are committed to the MDB format then you can access the functionality of stored procedures via queries defined as 'pass through' queries and are documented in help.

In considering your options have a look also at the .ADP Project file format in Access it is designed to work directly with stored procedures and SQL server side records exposing the stored procedures and view interface for manipulation on the client side.

A simple example of using a code function within an ADP file to access a stored procedure where it accepts input parameters comprising of a date from and a date to value derived from, shall we say, a main menu screenform and returning a single output value to the client side application might be something like this (seemingly long winded visually speaking for a simple example that could be achieved in SQL I know,... but it merely illustrates the point)

Expand|Select|Wrap|Line Numbers
  1.  Function GetMyCount() 
  2. On Error GoTo Err_GetMyCount
  3. Dim cmd As ADODB.Command
  4. Set cmd = New ADODB.Command
  5. cmd.ActiveConnection = CurrentProject.Connection
  6. cmd.CommandText = "dbo.usp_MyCountBetweenDates"
  7. cmd.CommandType = adCmdStoredProc
  8. Dim par As ADODB.Parameter
  9. Set par = cmd.CreateParameter("@datefrom", adDate, adParamInput)
  10. cmd.Parameters.Append par
  11. Set par = cmd.CreateParameter("@dateto", adDate, adParamInput)
  12. cmd.Parameters.Append par
  13. Set par = cmd.CreateParameter("@intResult", adInteger, adParamOutput)
  14. cmd.Parameters.Append par
  15. cmd.Parameters("@datefrom") = Format(Forms!frmMainMenu!DateFromCrit, "mm/dd/yyyy")
  16. cmd.Parameters("@dateto") = Format(Forms!frmMainMenu!DateToCrit, "mm/dd/yyyy")
  17. cmd.Execute
  18. GetBookingCount = cmd.Parameters("@intResult").Value & " Records"
  19. Exit_GetMyCount:
  20. Exit Function
  21. Err_GetMyCount:
  22. DoCmd.Hourglass False
  23. DoCmd.Echo True
  24. MsgBox err.Description,vbinformation,"System Function GetCount Error" 
  25. Resume Exit_GetMyCount
  26. End Function
  27.  
The server side stored procedure then might look something like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE PROCEDURE dbo.usp_MyCountBetweenDates
  3. (@datefrom datetime,@dateto datetime,@intResult int output)
  4. AS
  5. SET NOCOUNT ON
  6. SELECT @intResult=COUNT(*) FROM dbo.tblMyTable WITH (NOLOCK) WHERE (MyDate >=@datefrom AND MyDate<=@dateto)
  7. SELECT @intResult
  8. GO


Regards

Jim
Oct 16 '07 #3
voroojak
92 New Member
thanks alot
i try to do as you said. i hope it work for me. it seems hard.
thankssssssssss sssssssssssss
Oct 17 '07 #4
Jim Doherty
897 Recognized Expert Contributor
thanks alot
i try to do as you said. i hope it work for me. it seems hard.
thankssssssssss sssssssssssss
Well the learning curve is never simple.. but if you are working with stored procedures predominently then inevitably you going to need to know server side transact SQL language. If you intend to keep your transactions server side mostly you might as well dive straight in, do just that and work server side, and make the application reference and return only the data it needs. It is the optimum method of working with SQL Server

Regards

Jim :)
Oct 17 '07 #5

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

Similar topics

3
1658
by: 8leggeddj | last post by:
Hello, I am having a problem when using access xp as a frontend for sql server 2000. I have been trying to update a number of stored procedures (Just simple adding fields etc) which results in access crashing with event ID 1000 and 1001. Does anyone have any ideas as to what could be the problem? Thanks in advance..
2
11709
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. tCetecM1CUST (SQL Table that contains the Customer Information) tAccountingDetail (SQL Table that contains the information in the form) frmAccountingEntry (Access form used to enter data) spGetCustomerInformation (Stored Procedure which returns data using...
8
9871
by: Mark Flippin | last post by:
This is for a reporting problem using: Access 2000 SQL Server 2000 Both at SP3 I've a stored procedure in SQL Server 2000 which builds a result set from a disparate set of tables, utilizing a temp table. The procedure takes two parameters to specify the criteria on selecting the table information for inclusion in the result set, builds the temp table,
0
2580
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone. I discovered this the other day while doing some experiments with ADO and ADO.NET. Basically, I wanted to run a stored MS Access query with parameters using the syntax Execute MyProcedure @Param1, @Param2...
5
3486
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 Procedures. I thought stored pricedures were an Oracle/MS SQL Server thing and don't know how they work with Access Jet. I've looked at some of the help on stored procedures in A2003, but really don't understand what's going on. Can someone...
2
5458
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
6
9906
by: Peter Neumaier | last post by:
Hi, I am trying to select some data through a stored procedure and would like to store the result in a local access table. Is that possible? Can somebody provide an example? Thanks&regards! Peter
2
4108
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
14
4599
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but nothing seems to work. What data type must I return for this to be accepted as .NET stored procedure?
2
4090
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges the right to run the stored procedure but not the rights to directly access either the referenced tables or the extended stored procedure. TIA!
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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
6649
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
5277
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
3926
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
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.