Consulting

Results 1 to 2 of 2

Thread: Error 3001 when calling stored proc

  1. #1

    Error 3001 when calling stored proc

    I have a VBA module that I setup to call a stored proc on my SQL Server 2005 database. The proc works fine from the management interface. However, when I try to call it from VBA I get a 3001 error. I have tried both ways of loading the values into the parameters. TON creation of the parameter and after the parameter is created by assigning the value. Neither changes the result.

    [VBA]
    myEmp = CInt(DataSheet.tbEmployee.Value)
    Set prmEmp = cmd.CreateParameter("@in_emp_id", adInteger, adParamInput, 4, myEmp)
    'Append parameters
    With cmd
    .Parameters.Append prmEmp
    End With
    [/VBA]

    [VBA]
    myEmp = CInt(DataSheet.tbEmployee.Value)
    Set prmEmp = cmd.CreateParameter("@in_emp_id", adInteger, adParamInput)
    'Append parameters
    With cmd
    .Parameters.Append prmEmp
    End With
    prmEmp.Value = myEmp
    [/VBA]

    Since I have been pulling my hair out with this one, I am at a loss as to how I can get this data. It really does need to come from a proc because the data comes from two sources. I assume this is something I ought to be able to do. One choice I have considered is parsing the SQL and sending it in dynamically instead of calling the stored proc.

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    I had a similar problem; I solved it by just opening a Connection then running the stored proc with the .execute() method. Stan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •