Solved

Why do I get object required

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

821 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