Solved

Why do I get object required

Posted on 2013-10-31
3
327 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

739 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