Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    6

    Question Unanswered: Access 97 Reports HELP

    Anyone know how Access Reports work? I'm getting a recordset via VBA code. Loop through the recordset and displays the report. However, i only get the last record to show up. I loop through the recordset in Detail_Format.

    Has anyone done a report with VBA driven? Thanks!

  2. #2
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238

    Re: Access 97 Reports HELP

    Originally posted by NetGuy
    Anyone know how Access Reports work? I'm getting a recordset via VBA code. Loop through the recordset and displays the report. However, i only get the last record to show up. I loop through the recordset in Detail_Format.

    Has anyone done a report with VBA driven? Thanks!
    In Access 2000 and above you can use the report recordset property to set the recordset.

    In Access 97 and above you can change the Recordsource property of the report using code such as:

    Private Sub Report_Open(Cancel As Integer)
    If Len(Me.OpenArgs) Then
    Me.RecordSource = strSQL
    Else
    MsgBox "No OpenArgs has been passed to the report. Please try again.", _
    vbInformation, "Cannot Load Report"
    Cancel = True
    End If
    End Sub

    You would call the report with DoCmd.OpenReport ReportName:="MrReport", View:=acViewPreview, OpenArgs:="SELECT * FROM MyTable"

    You could alternatively use the WhereCondition of the OpenReport method to filter the recordsource

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •