passing arguments to queries

  • Thread starter Thread starter zeta
  • Start date Start date
Z

zeta

Hi,

I want to open a report by clicking on a command button.
Depending on which button is clicked it will pass an
argument to a Sub that will open a report with data based
on a sql statement in the sub that takes the arguments
passed to the sub.

Sorry for the poor sentence structure, but there is a lot
of passing going on.

Is this possible?

Thanks
 
Hi,


Well... just do it ?


Under the button click event:

Call MySub( ValueBeingPassed )


and, the subroutine, in the same form-module:


Private Sub MySub( ByVal Argument As ... )
DoCmd.OpenReport, reportNameHere, OpenArgs:= Argument
End Sub


or variations on that, but you didn't supply enough info, I am afraid,
if there is something else to consider in the context. As example, you can
use two argument to the MySub, one being the report name itself to be open,
etc.

Note that OpenArgs, with DoCmd.OpenReport, exist only for most recent
versions of Access.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top