View Single Post
  #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