[Webinar] Streamline your web hosting managementRegister Today


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
LVL 71

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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

607 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