Re: Command button report selection
- From: "Duane Hookom" <duanehookom@xxxxxxxxxxxxxxxxx>
- Date: Mon, 23 May 2005 09:11:32 -0500
I would not expose a list like this to my users. My report names are not for
public consumption since they use a naming convention like "rptEmpOTHrs"
etc. Also, selecting from msysobjects would list all of my subreports which
are not meant to be viewed alone.
It take a couple minutes to create a table of reports with a structure like:
tblReports
=============
rptRptName ->report object name
rptTitle ->user exposed name
rptComments ->what the report is used for
rptStatus ->active or under development...
rpt... other fields that might help
make the system more manageable
Use the table as the source for the combo box or list box.
--
Duane Hookom
MS Access MVP
--
"Nikos Yannacopoulos" <nyannacoREMOVETHISBIT@xxxxx> wrote in message
news:%23c$iJo5XFHA.3572@xxxxxxxxxxxxxxxxxxxxxxx
> DK,
>
> Not only is it possible, but also easy to take it a step further! Instead
> of typing in the possible values for the combo, change its Row Source Type
> property to Table/Query, and set the Row Source proprty to:
>
> SELECT Name FROM MSysObjects WHERE Type = -32764
>
> This will force the combo to "read" dynamically the list of reports, so
> you don't need to change the form design when you add a new report or
> delete an obsolete one. The exact same thing will work with a listbox
> instead of a combo, which I personally prefer for this particular use.
>
> Having done this, and assuming the name of the combo is cboReports, the
> code behind the command button should be:
>
> vRep = Me.cboReports
> If Len(Me.cboReports) = 0 Then
> Msgbox "No report selected!", vbExclamation, _
> & "Problem running report"
> Exit Sub
> End If
> DoCmd.OpenReport vRep, acViewPreview
>
> to preview the report, or, to print it diretly (to the default printer),
> change the last argument form acViewPreview to acViewNormal.
>
> HTH,
> Nikos
>
> DK wrote:
>> Greetings,
>>
>> I'm trying to create a Form that based on the users combo box selections,
>> the correct report will run when a command button is selected.
>>
>> This is only a two variable model in that I would like "Report A" to run
>> when "A" is selected in the combo box or "Report B" to run when "B" is
>> selected.
>>
>> Is there a way to code the command button to run the correct report based
>> on the selections?
>>
>> Thanks in advance!
.
- References:
- Command button report selection
- From: DK
- Re: Command button report selection
- From: Nikos Yannacopoulos
- Command button report selection
- Prev by Date: Displaying Data as a Pyramid
- Next by Date: Re: Command button report selection
- Previous by thread: Re: Command button report selection
- Next by thread: Re: Command button report selection
- Index(es):
Relevant Pages
|