use the ReportObject variable to show which report is current open to use its information off??
Hmmmm, good question. You could place something like the following in a standard module.
Public ReportObject As Report
or
Public ReportObject As Object
If you feel you need a reference to the object as an object, what you are doing in the load event or open event is probably best. Otherwise, you might create a copy of the report trying to instantiate the object another way.
ReportObject =activeObject
Having said all of that, why not use the fully qualified name of the report from your pop-up form?
Reports!ReportName
Another approach might be to use a global variable and a function. I believe something like the following will create a reference to the open form or report. In other words, it will not create a new instance. It will reference the actual open report instance.
In a standard module
Code:
Public gobjMenuLinkTo As Object
Public Sub LaunchFloatingMenu(ObjectName As String, Optional IsReport As Boolean = -1)
Set gobjMenuLinkTo = Nothing
If IsReport Then
Set gobjMenuLinkTo = Application.Reports(ObjectName)
Else
Set gobjMenuLinkTo = Application.Forms(ObjectName)
End If
DoCmd.OpenForm "frmFloatingMenu"
And then call the function from the Report or even a form object ...
Code:
LaunchFloatingMenu Me.Name, False
'or
LaunchFloatingMenu Me.Name