Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    Form Code (2000)

    I am trying to get a form to work but I keep getting the following error:
    Wrong number of arguments or invalid property assignment.
    The code is below: The error highlights "OpenReport"

    Private Sub lstReports_Click()
    Dim rpt As New Report
    Dim rptString As String

    On Error GoTo errHandler

    rptString = Me!lstReports.Value
    DoCmd.OpenReport rptString, acViewPreview, _
    , , acHidden
    Set rpt = Reports(rptString)
    Me!lstFields.RowSourceType = "Field List"
    Me!lstFields.RowSource = rpt.RecordSource
    Me!lstFields.Enabled = True
    Me!lstValues.Enabled = False
    Me!lstValues.RowSource = ""
    DoCmd.Close acReport, rptString

    Set rpt = Nothing
    Exit Sub

    MsgBox Err.Number & ": " & Err.Description, _
    vbOKOnly, "Error"
    Resume ExitProc
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Form Code (2000)

    If I'm not mistaken, the WindowMode argument (acHidden) for DoCmd.OpenReport is not available in Access 2000 or earlier, it was introduced in Access 2002, together with the OpenArgs argument. The syntax in Access 2000 is

    DoCmd.OpenReport ReportName, View, FilterName, WhereCondition

    while that in Access 2002 is

    DoCmd.OpenReport ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts