Re: Opening report from a form field as parameter



Consider changing your code to:

Private Sub btnGenerateReport_Click()
Dim strWhere as String
If cboDivision.Value <> "" Then
DataExchange.SetHeading cboDivision.Value
strWhere = "[Division] like '" & Me.cboDivision & "*'"
DoCmd.OpenReport rptRentRoll, acViewPreview, , strWhere
DoCmd.Maximize
Else
MsgBox "Veuillez sélectionner une bannière de la liste déroulante."
End If
End Sub

--
Duane Hookom
MS Access MVP


"Alain" <abilodeau@xxxxxxxxxxxxx> wrote in message
news:yCise.7691$Qr3.1030572@xxxxxxxxxxxxxxxxxxxxxxxx
> Hi ,
>
> I would like to know on how to fix this problem when I open a report with
> a criteria as a filter,
> "The Action or Method requires a ReportName Argument" is showing at the
> docmd.openreport
>
> Here is the code I use on my form
> Private Sub btnGenerateReport_Click()
> If cboDivision.Value <> "" Then
> DataExchange.SetHeading cboDivision.Value
> DoCmd.OpenReport rptRentRoll, acViewPreview
> DoCmd.Maximize
> Else
> MsgBox "Veuillez sélectionner une bannière de la liste déroulante."
> End If
> End Sub
> and here is the code I use on my report
> Me.FilterOn = True
> Me.Filter = "Division like '" & Forms!ReportGenerator!cboDivision.Value
> & "*'"
>
> TIA
>
> Alain
>
>


.



Relevant Pages

  • RE: On Close
    ... Microsoft Access MVP ... The only code i have in previewing the report is: ... Private Sub Report_Open ... "Duane Hookom" wrote: ...
    (microsoft.public.access.reports)
  • RE: On Close
    ... The only code i have in previewing the report is: ... Private Sub Report_Open ... "Duane Hookom" wrote: ... Microsoft Access MVP ...
    (microsoft.public.access.reports)
  • RE: On Close
    ... Private Sub Report_Open ... "Duane Hookom" wrote: ... changes in the subreports Source Object so am being promted when closing. ... report without saving? ...
    (microsoft.public.access.reports)
  • Re: Using variables to make code faster and more efficient?
    ... and what you mean by "bring up the query's report from the form". ... <MS ACCESS MVP> ... "Ken Snell " wrote: ... Private Sub Search_Options_Click ...
    (microsoft.public.access.formscoding)
  • Re: Error: Microsoft jet database engine does not recognize " as a va
    ... If you are attempting to create a crosstab report with dynamic columns, ... > Dim rstReport As DAO.Recordset ... > Dim intX As Integer ... > Private Sub Detail_Format ...
    (microsoft.public.access.reports)