Setting Report Recordset Property (ADO)

G

Guest

I am trying to run a report with data from an external access database.

I a using ADO to open a recordset in the external database, but get the
following error when I set the report's recordset property: "This feature is
not available in MDB."

The code below is assigned to the report's Open event. The code breaks at
"Set Me.Recordset = rs"

Thanks,
DEI

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim connstring As String

connstring = "Provider=Microsoft.Jet.OLEDB.4.40;" & _
"Data Source=E:\Nursing Exits\NursingExitConv.mdb"

Set conn = New ADODB.Connection

With conn
.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\Nursing Exits\NursingExitConv.mdb"
End With

Set rs = New Recordset

With rs
Set .ActiveConnection = conn
.Source = "SELECT * FROM NursingExitData"
End With

Set Me.Recordset = rs

Set rs = Nothing
Set conn = Nothing
 
D

Douglas J. Steele

Why not simply use a query in your database as the RecordSource? There's
certainly no advantage to using ADO if you're simply going against a Jet
database.
 
D

Dirk Goldgar

DEI said:
I am trying to run a report with data from an external access
database.

I a using ADO to open a recordset in the external database, but get
the following error when I set the report's recordset property: "This
feature is not available in MDB."

The code below is assigned to the report's Open event. The code
breaks at "Set Me.Recordset = rs"

Apparently, the Recordset property of a report is only available in
Access Data Projects, not in MDB files:

http://support.microsoft.com/default.aspx?scid=kb;en-us;287437
You may receive the "Run-time error 2593" error message when you set
or you retrieve the Recordset property of a report in an Access database

<quote>
CAUSE
Reports in a Microsoft Access database do not support the use of the
Recordset property.

</quote>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top