Contextual ribbon tabs

Pyro

Too busy to comment
Local time
Today, 12:42
Joined
Apr 2, 2009
Messages
127
tl;dr
How does one refer to the object (form or report) from which a contextual ribbon tab is called?

The story
I have a contextual ribbon tab that is used for previewing reports. There are the standard print, zoom, close etc buttons which are just built in features of Access. I also have a function that exports a report to PDF, and emails it with some additional data added to the body of the email. This function accepts the report object name as a parameter, and the rest is standard hard coded stuff. Does anybody have a suggestion for how to reference the report object that calls my contextual ribbon tab? The same ribbon could be launched from several reports.

The only idea i have had thus far is to create a new tab for each report. Each instance of this tab would be identical except for the tag property of the command button calling my function which would store the report object name. This seems tedious, and there must be a better way.
 
This was one of those occasions where i think i had fallen too far down the rabbit hole, and was definitely overthinking. The answer was simply:

Code:
Screen.ActiveReport.Name

Clicking on any control in a contextual tab activates the underlying object that the tab has been called from.
 

Users who are viewing this thread

Back
Top Bottom