Solved

Why do I get object required

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

Accepted Solution

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

Author Comment

by:mgmhicks
Comment Utility
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 25

Expert Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now