Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Why do I get object required

Posted on 2013-10-31
3
Medium Priority
?
330 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 27

Accepted Solution

by:
Shaun Kline earned 2000 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 27

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses

610 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