Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2009
    Posts
    89

    Unanswered: Open a new isntance of the same report?

    Hi. I have a datasheet where if you click on an item it opens up a report about that item. At the moment, If i open one report, then go back to the datasheet and try open another report, it will just bring the first one back into focus.

    Is there any way I can make it open a new instance of a report regardless if it's already open showing other data?

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    Is it the same report object that's being called or is it another object?
    Me.Geek = True

  3. #3
    Join Date
    Jun 2009
    Posts
    89
    I'm not sure what you mean by object. Basically from the list of records, when i click on one it runs DoCmd.Open Report RentReport,,,[ID]=Me.ID, and that opens the report fine. If i then leave it open and click on the next row's link (so it's the same function but ID will be different), the first report gets focus and nothing new opens.

    Any ideas?

  4. #4
    Join Date
    May 2005
    Posts
    1,191

  5. #5
    Join Date
    Jun 2009
    Posts
    89
    OK I'm having some trouble here :-(

    So far i've got the following code@
    Code:
    Option Compare Database
    Option Explicit
    Dim frmX As Version
    
    Private Sub Text27_Click()
        Set frmX = New Version
        frmX.SetFocus
    End Sub
    The report I want to open is called Version. The Error I'm geting is "User-Defined Type not defined, SO i'm gyuessing it doesn't know what "Version" is.

    How do I reference the report??

  6. #6
    Join Date
    May 2005
    Posts
    1,191
    When you say
    Code:
    Dim X as Y
    X can be whatever you want to name it, provided it meets Access naming conventions (not a reserved word, alpha-numeric with underscores or hyphens I think are the rules). Y however needs to be an object or a variable or whatever you want to declare X as.

    So first of all I would strongly recommend you change the name of the report since it's a reserved word, see my rant here for naming guidelines I suggest.

    Secondly (let's say you rename your report to be "rptVersion"), your dim statement needs to declare it as a report, so like:
    Code:
    Dim rptX as Report
    Then you're click event would be like:
    Code:
    Private Sub Text27_Click()
       Set rptX = New rptVersion
       rptX.setfocus
    End Sub
    (untested code)
    Me.Geek = True

Posting Permissions

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