Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error on opening a report from a form (Access 2k, Win2K Pro)

    I am trying to use DoCmd.OpenReport to run dynamic filters on a basic report using the LIKE operator. I think it's set up to pass the param needed but when I run it I get "Compile Error - Argument not optional." The code uses a select case to generate the Where condition on the OpenReport function, so I don't see what the problem is.

    here's the code to open the report:

    DoCmd.OpenReport , acViewNormal, , strWhere

    one of the Select Case options is:

    strWhere = "OIGDivision LIKE " & quote & "Enforcement - Field Investigations" & quote & " Or Like " & quote & "Enforcement

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error on opening a report from a form (Access 2k, Win2K Pro)

    I don't understand why you get a compile error, but your where condition is not entirely correct. It should be

    strWhere = "OIGDivision Like " & quote & "Enforcement - Field Investigations" & quote & " Or OIGDivision Like " & quote & "Enforcement

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error on opening a report from a form (Access 2k, Win2K Pro)

    You haven't specified the report to be opened.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error on opening a report from a form (Access 2k, Win2K Pro)

    yes, you are correct - I left out the name of the report to open!!

    <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

Posting Permissions

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