Re: Command button report selection

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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!


.



Relevant Pages

  • Re: Preview/Print reports from selections in unbound combo box.
    ... You may be able to use the command button wizard to help. ... the code to get the report name from the combo box. ... > I would like to preview/print reports from selections in an unbound combo ... This is a big deal to me as I have very little code skills. ...
    (microsoft.public.access.formscoding)
  • RE: Storing Multiple selections in list boxes
    ... list boxes from which the user may make multiple selections. ... builds a string that can be used for filtering the report: ... Private Function BuildWhereCondition(strControl As String) As String ... Dim strWhere As String ...
    (microsoft.public.access.gettingstarted)
  • Re: Saving changes on form before running a report
    ... On the Command button (that you already use to open the report) ... When the code window opens, the cursor will be flashing between 2 ... DoCmd.OpenReport "ReportName", acViewPreview ...
    (microsoft.public.access.forms)
  • Re: Command button report selection
    ... > SELECT Name FROM MSysObjects WHERE Type = -32764 ... > to preview the report, or, to print it diretly, ... > change the last argument form acViewPreview to acViewNormal. ... >> I'm trying to create a Form that based on the users combo box selections, ...
    (microsoft.public.access.reports)
  • Ugly file import into Excel
    ... Using an Ansi report to be imported and final tallies MUST be done using only ... Excel. ... Cancelled Selections - No, Comments - No, Detail and Summary, Summary ... Report Agent Moves: No ...
    (microsoft.public.excel.programming)