Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Guatemala City
    Thanked 0 Times in 0 Posts

    Opening multiple copies of the same report in the same window

    I need to show similar copies of the same report, varying only the name of the customer. I found a piece of code in Access 2010 VBA Programming Inside/Out, as follows. It does the job, but I donīt follow one line of the code. Can you help?

    Code as follows:
    Option Compare Database
    Option Explicit
    Dim colReports As New Collection
    Private Sub Customer_Name_DblClick(Cancel As Integer)
    Dim rpt As Report_rptCustomerDetails
    Set rpt = New Report_rptCustomerDetails
    rpt.Filter = "[Customer Number] = " & Me.Customer_Number
    rpt.FilterOn = True
    colReports.Add rpt, CStr(CLng(Rnd * (2 ^ 31)))
    rpt.Visible = True
    End Sub

    What if the last paramater on line nine doing?

  2. #2
    Join Date
    Feb 2011
    Thanked 6 Times in 6 Posts
    CStr(CLng(Rnd * (2 ^ 31))) is generating a random, and hopefully unique, number which is used as the Key value to the particular instance of the specific report object that you are creating in the collection of reports.

Posting Permissions

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