LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Use ADO Parameters in loop

Is it possible to use ADO Parameter objects in a loop? If
so, what am I doing wrong.

Here's some sample code:

SampleArray("Brian","David","Mark")

For MyNames = 0 To UBound(SampleArray)
With cm
.ActiveConnection = cn
.CommandText = "qryAccessQuery"
.CommandType = adCmdStoredProc
Set pm1 = cm.CreateParameter("NameField",
adVarChar, adParamInput, 5)
..Parameters.Append pm1
pm1.Value = SampleArray(MyNames)
End With

rs.Open cm
'.......code to use recordset
rs.close

next MyNames

I can get through the loop once okay. But I need to
somehow clear the parameter so it can accept a new value.
All I've managed to do is continue appending parameters.

How's this done?

tod
 
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
parameters DavidC Excel Discussion (Misc queries) 3 October 12th 09 06:48 PM
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Too few parameters Laebrye Excel Discussion (Misc queries) 1 May 26th 09 11:56 AM
Worksheet_Change - loop within a loop bgm Excel Programming 1 January 19th 04 01:27 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


All times are GMT +1. The time now is 08:38 AM.

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"