Urgent, Please Help!!

Results 1 to 3 of 3

Thread: Urgent, Please Help!!

  1. #1
    Charles Guest

    Default Urgent, Please Help!!

    When I try to pass an account number, I&#039;m getting the following error message: Item cannot be found in the collection corresponding to the requested name or ordinal. The error appears at line: Set var2 = var1.GetOrderTest(AccountNumber) <BR><BR>Any ideas what&#039;s causing such error message, the accountnumber that I am passing does exist in the data base. <BR><BR>Thanks,<BR><BR>Code from VB:<BR><BR> Dim var1 As SNCls3.SNOrderDir3 <BR> Dim var2 As Collection <BR> Dim var3 <BR> AccountNumber = Trim("test12345") <BR> Set var1 = CreateObject("SNCls3.SNOrderDir3") <BR> Set var2 = var1.GetOrderTest(AccountNumber) <BR> For Each var3 In var2 <BR> List1.AddItem var3.Symbol & " " & var3.OrderType & " " & var3.CompanyName & " " & var3.Quantity & " " & var3.OrderStatus & " " & var3.RecordId & " " & var3.TransactionType & " " & var3.CurrentDate & " " <BR> Next <BR> Set var1 = Nothing <BR> Set var2 = Nothing <BR><BR>COM: <BR>Public Function GetOrderTest(AccountNumber) As Collection <BR> Dim objOContext As ObjectContext <BR> Set objOContext = GetObjectContext() <BR> Dim lErrNo As Long <BR> Dim sErrDesc As String <BR> On Error GoTo ErrorHandler <BR> Dim GetOrders As New Collection <BR> Dim objConn As New ADODB.connection <BR> Dim objRS As New ADODB.recordset <BR> Dim objCommand As New ADODB.Command <BR> Dim objParam As New ADODB.Parameter <BR> With objConn <BR> .ConnectionString = DB_CONNECTIONSTRING <BR> .Open <BR> End With <BR> &#039;Use command object to send accountnumber to stored procedure <BR> &#039;******************************************** **************** <BR> Set objCommand = New ADODB.Command <BR> With objCommand <BR> .CommandText = "GetTest" <BR> .CommandType = adCmdStoredProc <BR> .ActiveConnection = objConn <BR> End With <BR> Set objParam = objCommand.CreateParameter("@AccountNumber", adVarChar, adParamInput, 9, AccountNumber) <BR> objCommand.Parameters.Append objParam <BR> Set objRS = objCommand.Execute <BR> &#039;******************************************** ************************** <BR> &#039;recordset.Open "GetTest", connection, adOpenForwardOnly, adLockReadOnly, adCmdText <BR> Do While Not objRS.EOF <BR> Dim SNOrder As New SNCls3.SNOrder3 <BR> SNOrder.Symbol = Trim$(recordset("Symbol")) <BR> SNOrder.OrderType = Trim$(recordset("OrderType")) <BR> SNOrder.CompanyName = Trim$(recordset("CompanyName")) <BR> SNOrder.TransactionType = Trim$(recordset("TransactionType")) <BR> SNOrder.Quantity = Trim$(recordset("Quantity")) <BR> SNOrder.RecordId = Trim$(recordset("RecordID")) <BR> SNOrder.OrderStatus = Trim$(recordset("OrderStatus")) <BR> SNOrder.CurrentDate = Trim$(recordset("CurrentDate")) <BR> SNOrder.TradeDate = Trim$(recordset("TradeDate")) <BR> SNOrder.SettlementDate = Trim$(recordset("SettlementDate")) <BR> SNOrder.AccountType = Trim$(recordset("AccountType")) <BR> SNOrder.Price = Trim$(recordset("Price")) <BR> SNOrder.Duration = Trim$(recordset("Duration")) <BR> SNOrder.CommissionType = Trim$(recordset("CommissionType")) <BR> SNOrder.Solicited = Trim$(recordset("Solicited")) <BR> SNOrder.Canceldate = Trim$(recordset("CancelDate")) <BR> SNOrder.SNCustomerAccNum = Trim$(recordset("SNCustomerAccNum")) <BR> SNOrder.SNOrderSeqNum = Trim$(recordset("SNOrderSeqNum")) <BR> SNOrder.PershingRefNum = Trim$(recordset("PershingRefNum")) <BR> SNOrder.EnteredToPershing = Trim$(recordset("EnteredToPershing")) <BR> SNOrder.CancelOrder = Trim$(recordset("CancelOrder")) <BR> SNOrder.LastUpdate = Trim$(recordset("LastUpdate")) <BR> <BR> GetOrders.Add SNOrder <BR> Set SNOrder = Nothing <BR> objRS.MoveNext <BR> Loop <BR> &#039; Using MTS to complete transaction <BR> objOContext.SetComplete <BR> Set objRS = Nothing <BR> Set objConn = Nothing <BR> Set GetOrderTest = GetOrders <BR> Exit Function

  2. #2
    Neils Guest

    Default RE: Urgent, Please Help!!

    This error usually pops up when you&#039;re trying to access a _column_ that does not exist.

  3. #3
    Charles Guest

    Default RE: Urgent, Please Help!!

    I checked my code and all the fields exist in my table; Do you any other suggestions?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts