Solved

RunTime Error

Posted on 2002-07-06
3
141 Views
Last Modified: 2010-05-02
i implemented my Application using Com+, i'm getting this error:Run time error "3251": ....etc.
i checked this link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q201716.
and i checked my code it contains the following:

Private Sub ObjectControl_Activate()
Set Cnn = New ADODB.Connection
Set Cmd = New ADODB.Command
On Error GoTo Err_Cnn
    Cnn.Open connstr
Exit Sub
Err_Cnn:
   ChkVal = 1
Set mV2 = GetObjectContext()
  End Sub


Public Function OpenRecordSet(spName As String, ParamArray AttachedParameters() As Variant) As ADODB.Recordset
'Dim MyRec As ADODB.Recordset
Set Rs = New ADODB.Recordset
Dim i As Long
If Rs.State = adStateOpen Then
   Rs.Close
End If
With Rs
    .CursorType = adOpenKeyset
    .LockType = adLockOptimistic
    .CursorLocation = adUseClient  '<-- Add this line
End With

On Error GoTo ERRORHANDLER
     Cmd.CommandTimeout = 3600
     Cmd.ActiveConnection = Cnn
     Cmd.CommandType = 4 'Stored Procedure
     Cmd.CommandText = Trim(spName)
        If UBound(AttachedParameters) >= 0 Then
            Cmd.Parameters.Refresh
            For i = 0 To UBound(AttachedParameters)
                Cmd.Parameters(i + 1).Value = AttachedParameters(i)
            Next i
        End If
     Rs.Open Cmd
     Set OpenRecordSet = Rs
     Exit Function
ERRORHANDLER:
    Set OpenRecordSet = Nothing
    End If
End Function

Private Sub ObjectControl_Deactivate()
    Set Cnn = Nothing
    Set Cmd = Nothing
    Set Rs = Nothing
    Set mV2 = Nothing
End Sub
........ i tried to comment the deactivate Sub as to keep the record connected but still i'm getting the error:-(
Any Help!!!!!
Regards Meer.
0
Comment
Question by:mirghani
3 Comments
 
LVL 22

Accepted Solution

by:
mnasman earned 100 total points
ID: 7134215
0
 

Author Comment

by:mirghani
ID: 7134643
i tried the link but still:-(
if i set the CursorLocation=adUseServer it will not work at all!!!!!
any help.....?
Meer.
0
 
LVL 5

Expert Comment

by:rpai
ID: 7137874
Do you know what line of code raises the error? And how are Cmd and Cnn declared?
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VB6 convert MSHFlexgrid1 cells 7 52
Help in WHSCRIPT 9 41
Validating VB6 Function 19 49
VBA error replacing data 6 35
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

706 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

16 Experts available now in Live!

Get 1:1 Help Now