Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Passing an array or recordset to a stored procedure

Hi
The VBA function that generates the array should give the array as a
Variant output

e.g.
Public Function MakeArray(your input variables) as Variant

loads of code to create MyArray
MakeArray = MyArray (now a Variant)

end Function

Your procedure now uses this Variant as input. The function is Public,
so you can call it throughout your Project.

Sub ProcessArray(MyVariant as Variant)

do stuff
end sub

and is called by

ProcessArray MakeArray(your input variables)

Note that the Variant you are processing is a 1 based array, and you
treat it as such. You can get its dimensions using the UBound function
and refer to its elements in the normal way e.g. MyVariant(1,3)

regards
Paul




"Raul" wrote in message ...
I need to pass an array of data to a stored procedure
that will evaluate the data and insert it into the
database. I have created a VBA routine that generates
the array. I have also written a stored procedure using
local variables that does what I need to on the database
side. Now I need some help figuring out how pass the
data to the stored procedure.

Any suggestions?

Thanks,
Raul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Passing an array or recordset to a stored procedure

Thanks,
Raul

"Paul Robinson" wrote:

Hi
The VBA function that generates the array should give the array as a
Variant output

e.g.
Public Function MakeArray(your input variables) as Variant

loads of code to create MyArray
MakeArray = MyArray (now a Variant)

end Function

Your procedure now uses this Variant as input. The function is Public,
so you can call it throughout your Project.

Sub ProcessArray(MyVariant as Variant)

do stuff
end sub

and is called by

ProcessArray MakeArray(your input variables)

Note that the Variant you are processing is a 1 based array, and you
treat it as such. You can get its dimensions using the UBound function
and refer to its elements in the normal way e.g. MyVariant(1,3)

regards
Paul




"Raul" wrote in message ...
I need to pass an array of data to a stored procedure
that will evaluate the data and insert it into the
database. I have created a VBA routine that generates
the array. I have also written a stored procedure using
local variables that does what I need to on the database
side. Now I need some help figuring out how pass the
data to the stored procedure.

Any suggestions?

Thanks,
Raul


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing an array or recordset to a stored procedure Robin Hammond[_2_] Excel Programming 1 December 2nd 04 05:15 AM
Stored Procedure call and passing parameters TLowe Excel Programming 3 April 23rd 04 10:09 AM
Run a stored procedure in Excel 2K ArthurB Excel Programming 0 February 26th 04 04:46 PM
Execute stored procedure using DAO sapta wijaya Excel Programming 0 September 29th 03 04:24 AM
Passing parameter from Excel to stored procedure? hmmm... Excel Programming 1 July 25th 03 02:59 PM


All times are GMT +1. The time now is 01:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"