Returning an ADO Recordset to a client

Posted on 1999-07-01
Medium Priority
Last Modified: 2013-11-23
I am trying to return an ado recordset from an activex exe running on a server to a client program.  I can get the server portion to run, but i get error 429 (cant create activex object) when i run it.  I know the recordset is being created on the server as it prints out its contents before returning.  Here is the code for the 2 programs, written in vb6 enterprise with ADO 2.1  ..

CLIENT ------------------------------------
Dim GetDays As Object

Private Sub Form_Load()
  Set GetDays = CreateObject ("SybaseFunctions.Print", "55dvlpmt")
End Sub

Private Sub cmdPrintLocal_Click()
    Dim rsDays As New ADODB.Recordset
    Set rsDays = GetDays.DaysRecordset()  'Error occurs here
    PrintTable         'Print out the recordset
End Sub

SERVER (ActiveX EXE) -----------------------------------
Dim DB As New ADODB.Connection
Dim RS As New ADODB.Recordset

Public Function DaysRecordset() As ADODB.Recordset
    On Error Resume Next
    GetRecordset   'Opens a connection and sets recordset RS
    Set RS.ActiveConnection = Nothing
    Set DaysRecordset = RS
End Function
Question by:scorpionjl
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 70

Accepted Solution

Éric Moreau earned 400 total points
ID: 1521365
I suspect your GetRecordset.

I have the following code (modified for you) in a class module and it work just like it is supposed to be:
Public Function DaysRecordset() As ADODB.Recordset
Dim rstTemp as ADODB.Recordset

    On Error Resume Next

    set rstTemp = ADODB.Recordset
    rstTemp.Open "SQL Query", rs.ActiveConnection
    Set DaysRecordset = rstTemp
End Function
LVL 15

Expert Comment

ID: 1521366
>On Error Resume Next
You should use different error handling in your GetRecordset and DaysRecordset functions.
So, if your client side ADOR.Recordset is not created, you'll have more info in your Err object.

See mdougan's comments and my code sample in:

Author Comment

ID: 1521367
I dont see any difference between your recordset and mine, but its working now, so I really dont care either.  Thanx

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

719 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