Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding Access Report to ADO Recordset

Status
Not open for further replies.

RobK67

Programmer
Feb 4, 2004
1
US
Has anyone ever tied a Microsoft Access report to an ADO recordset? I am able to bind controls on a form, such as a combo box or list box to my ADO recordset, but I can't figure out how to do it with a report. Right now, my reports use ODBC links, but I'd like to get rid of these completely, since I will be distributing my app to a number of user.

The "processing" part of the app, does not use any of these ODBC links at all. I am using ADO to run both stored procedure and pass SQL statements to a SQL server, and that part works great. The last part I'm having trouble with in trying to get my reports to use an ADO recordset.

I have been searching all over the internet for someone that has done this, but I've had no luck. I am beginning to wonder if it's even possible? I'm using Access 2000.

Thanks...

-Rob
rkieft@uhc.com
 
This might be a bit difficult but here is some DAO code that you might try converting to ADO:
Code:
Option Compare Database
Dim db As DAO.database
Dim rs As DAO.Recordset

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.CurrentX = 200
    Me.CurrentY = 10
    Me.Print rs.Fields("Field1")
    Me.CurrentY = 10
    Me.CurrentX = Me.CurrentX + 300
    Me.Print rs.Fields("Field2")
    rs.MoveNext
    If Not rs.EOF Then
        Me.MoveLayout = True
        Me.PrintSection = True
        Me.NextRecord = False
    End If

End Sub

Private Sub Report_Close()
    On Error Resume Next
    rs.Close
    Set rs = Nothing
    Set db = Nothing

End Sub

Private Sub Report_Open(Cancel As Integer)
    Set db = CurrentDb
    Set rs = db.OpenRecordset("SELECT Field1, Field2 FROM tblA")
End Sub

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top