Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OpenArgs is null (Access 2003/XP)

    This has me stumped.
    In my app I have 2 reports that I want to pass parameters to when they open. The reports are very similar. In both cases, I'm using DoCmd.OpenReport "rptMoStatement", acViewPreview, , , acWindowNormal, strWHERE. In one case, the report's open event reads the opening argument string. In the other, it says openargs is null.

    Any clue why?

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

    Re: OpenArgs is null (Access 2003/XP)

    1. Have you checked very carefully whether the number of commas in the statement is correct in both cases? If you omit one, the strWhere argument would not be in the correct position.
    2. Have you checked that strWhere is actually assigned a value in both cases?
    (3. The name strWhere seems more appropriate for the WhereCondition argument than for the OpenArgs argument.)

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OpenArgs is null (Access 2003/XP)

    Yes to both your questions.

    The variable name was originally used to pass a querydef, but I found a more effective way to do that. Just never changed the variable name.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OpenArgs is null (Access 2003/XP)

    Just for fun, I made a copy of the report that is reading the openargs string, called it by a different name, and tried opening it with the same docmd method.
    Identical report, identical code module, just a different report name.
    Got ISNULL for openargs.

    Is this an Access 2003 bug?

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

    Re: OpenArgs is null (Access 2003/XP)

    I'm afraid I have no further ideas. If you wish, you can try to post a stripped down copy of the database.
    <UL><LI>Make a copy of the database and work with that.
    <LI>Remove all database objects (tables, queries, forms, reports, macros and modules) that are not relevant to the problem.
    <LI>In the remaining table(s), remove most records - leave only the minimum number necessary to demonstrate the problem.
    <LI>Remove or modify data of a confidential nature.
    <LI>Do a compact and repair (Tools/Database Utilities).
    <LI>Make a zip file containing the database; it should be below 100KB.
    <LI>If you have difficulties getting the zip file below 100 KB, save the database in Access 97 format and then zip it.
    <LI>Attach the zip file to a reply.[/list]That would allow Loungers to look at the problem directly.

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

    Re: OpenArgs is null (Access 2003/XP)

    I don't have Access 2003 myself. There are a few newsgroup posts about OpenArgs in Access 2003, but nothing really conclusive, so I don't know if it is a bug.

  7. #7
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OpenArgs is null (Access 2003/XP)

    (Edited by HansV to provide link to MSKB article - see <!help=19>Help 19<!/help>)

    I'm suspicious, because I found a <!mskb=836030>Microsoft Knowledge Base Article 836030<!/mskb> that says, tantalyzingly, that the following bug in Access 2002 was fixed in SP3:

    "The OpenArgs function only works one time in a VBA project

    If your MS VBA code for a form makes a call to the OpenArgs function after you open the form in design mode, yhou may receive the following VBA error message:

    Run-time error: 94
    Invalid use of Null

    No hyperlink to any more info, and my app is a regular .mdb, not a .mda, plus the problem is in a report, not a form, nor does an error message display.
    Still, this is Microsoft . . .
    Any suggestions as to how to find out more?

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

    Re: OpenArgs is null (Access 2003/XP)

    That must be an obscure bug, for I have never encountered it in Access 2002 (I don't think they meant an .mda in that section)

    No further ideas, except what I posted higher up in this thread.

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: OpenArgs is null (Access 2003/XP)

    The question is *when* is OpenArgs null? If it is not null in the Report_Open event, then just store the value in a module level variable and refer to the variable after that. Then it will work regardless of whether or not it has been "fixed". I've never seen the aforementioned bug in 2000, but then I don't keep referring to OpenArgs elsewhere in the report.
    Charlotte

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

    Re: OpenArgs is null (Access 2003/XP)

    I've had problems with OpenArgs for a form losing its value when the form has been open a while, so I tend to use a module level variable too. But Kathryn mentions explicitly that she got the error in the Open event of the report. I've never had problems with OpenArgs being unavailable in the Open event...

  11. #11
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: OpenArgs is null (Access 2003/XP)

    Yes, I realize that, Hans. However, if one report is OK and another isn't, I would suspect an unhandled error in the report that is experiencing the problem. If the value can't even be assigned to a string variable at the top of the Report_Open event, then it simply isn't making it into the report at all, as opposed to evaporating after it gets there.
    Charlotte

  12. #12
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OpenArgs is null (Access 2003/XP)

    Okay, I think we have solved it by installing SP1 for Office 2003. I have tested it on one PC so far, and no problems.

    Thanks to all of you for your help.

  13. #13
    Star Lounger
    Join Date
    Aug 2001
    Location
    Can Jose, CA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OpenArgs is null (Access 2003/XP)

    DB attached in zip. Idea is to scan badges of employees attending meeting, display info from last scan while prepping mainform ready for next scan. As last scan is displayed, colors are applied based on active status.
    "co-scan-in" is mainform.

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

    Re: OpenArgs is null (Access 2003/XP)

    The post by chrisseguin is actually a reply to <post#=439117>post 439117</post#>. I will post my reply there.

  15. #15
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: OpenArgs is null (Access 2003/XP)

    That isn't talking about once in a database, it's once in a form in that project, and please note the reference to opening it in design view.
    Charlotte

Page 1 of 2 12 LastLast

Posting Permissions

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