Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    51

    Unanswered: Call SQL Stored Procedure

    Greetings,

    Even though this may be not right place with this issue I would like to try!
    I facing with the problem “Object Variable or With Block variable not set” while I am trying to execute the stored procedure from Ms. Access form.
    I need some help very badly or maybe a good sample of code that works in this issue is very welcome.

    Many thanks in Advance

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    howzabout
    Code:
    		Dim oConn, oComm, oRS
    		Set oConn = CreateObject("ADODB.Connection")
    		Set oComm = CreateObject("ADODB.Command")
    		Set oRS = CreateObject("ADODB.RecordSet")
    	
    		' Open connection to database
    		oConn.ConnectionString = Application("ConnectionString")
    		oconn.Open
    		
    		' Use the stored proc
    		oComm.CommandType = 4 ' adStoredProc
    		oComm.ActiveConnection = oConn
    		oComm.CommandText = "spProcName"
    		oComm.Parameters.Refresh
    		oComm.Parameters("@ParameterName") = sParameterName
    		
    		oRS.CursorLocation = 3 ' adUseClient
    		oRS.Open oComm, , 3 ' adOpenStatic
    Dunno if that will help with the access form or not. This is from a VBScript snippet that I use.

    Regards,

    hmscott
    Have you hugged your backup today?

Posting Permissions

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