Solved

Why do I get object required

Posted on 2013-10-31
3
328 Views
Last Modified: 2013-11-01
I am try to create a command object and use it to create a recordset.   It keeps telling me object required on the parameter append line.  Can anyone tell me why?



thanks

Function GetPropertyData2(ByVal propID As String) As Boolean
    
    Dim myConnStr As String
    Dim rs As adodb.Recordset
    Set rs = New adodb.Recordset
    myConnStr = "Provider=sqloledb;Data Source=10.10.10.44,8433;Initial Catalog=TAG_eSite;User Id=sa;Password=;"
    Set con = New adodb.Connection
    con.ConnectionTimeout = 60
    con.CursorLocation = adUseClient
    con.Open myConnStr
    Dim str As String
      
   On Error GoTo Problem
   
    Dim myCMD As New adodb.Command
    Dim myConn As New adodb.Connection
    myConn.ConnectionString = myconstr
        
    With myCMD
        .ActiveConnection = con
        .CommandType = adCmdStoredProc
        .CommandText = "TAG_GetWebSitePayments"
                   .Parameters.Append (cmd.CreateParameter("@PropID", adVarChar, adParamInput, mPropID))
    End With
    Set rs = myCMD.Execute
       
   
    Dim c As Integer
       BankBook = Cells(i, 2)
        c = 4
        For m = 0 To 11
            mDate = Cells(7, c)
            myDate = Split(mDate, "/")
            mMonth = myDate(0)
            mYear = myDate(2)

Open in new window

0
Comment
Question by:mgmhicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 500 total points
ID: 39614646
Have you declared cmd in the cmd.CreateParameter statement? I'm only seeing myCMD.
0
 

Author Comment

by:mgmhicks
ID: 39614666
the line is now this still same error.

.Parameters.Append (myCMD.CreateParameter("@PropID", adVarChar, adParamInput, mPropID))


total lines

Dim myCMD As New adodb.Command
    Dim myConn As New adodb.Connection
    myConn.ConnectionString = myconstr
       
    With myCMD
        .ActiveConnection = con
        .CommandType = adCmdStoredProc
        .CommandText = "TAG_GetWebSitePayments"
        .Parameters.Append (myCMD.CreateParameter("@PropID", adVarChar, adParamInput, mPropID))
    End With
    Set rs = myCMD.Execute
0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 39614678
Same type of issue: where do you define mPropID. I see propID being passed into your function.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question