Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedures

Status
Not open for further replies.

diggermf

Programmer
Jun 16, 2008
20
US
Hi All,

Is it possible to write and execute the stored procedures in MS-ACCESS?

Thanks
digger
 
No.

You can write VBA functions that behave similarly. You can embed function calls in your query statements.

Gary
gwinn7
 
you can also create macros which produce vba code


Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Hi gwinn7

Could you please provide some example functions that behave similarly.

Thank you
 
VBA function:

Code:
Public Function MultiplyTwoNumbers (num1 As Integer, num2 As Integer) As Integer
  MultiplyTwoNumbers = num1 * num2
End Function

SQL code:
Code:
SELECT f1, f2, MultiplyTwoNumbers (f1, f2) As Result
FROM mytable

If you create a table called MyTable and enter the numbers 1 to 10 in field f1 and field f2, you should get
1 1 1
2 2 4
3 3 3
4 4 16
5 5 25
6 6 36
7 7 49
8 8 64
9 9 81
10 10 100

Although this one can easily be done in SQL itself, it shows how to call a VBA function from a query. Generally speaking, if you can do it with native SQL it will be a lot faster, especially if you have a lot of data in your tables.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top