• Mysterious parameter prompt (Access 2000 SR-1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Mysterious parameter prompt (Access 2000 SR-1)

    Author
    Topic
    #393948

    Hi,

    I’m using the DoCmd.OpenReport VBA method and I keep getting a mysterious dialog box. It’s titled Enter Parameter Value, and its text is the value that I was using as the filter in the OpenReport method. I’m not sure where this dialog box is coming from, since the query does not have any parameter statements in the criteria boxes. Also, I haven’t specified anything in the Query > Parameters dialog box in the query.

    The input box on this Enter Parameter Value dialog box is empty. If I leave it blank and press OK, the report produces without any data. If I enter the filter value in the input box, the report comes out OK.

    I’ve attached a copy of the dialog box to show what is appearing.

    Thanks,
    Bob

    Viewing 1 reply thread
    Author
    Replies
    • #718325

      Hi Bob…

      Can you show me the DoCmd statement?

      What’s happening is that Access won’t accept a string value in the Filtername argument of a DoCmd.OpenReport statement…
      It wants the name of a saved query that filters as you need it… You can do that if you want… Instead, I normally use the Where condition argument…
      DoCmd.OpenReport “Your Report Name”, acViewNormal, , “[YourField] = ‘CR005464′”
      (Even though it’s optional and not being used, you need to leave the comma in the right place for the filtername argument… )

      You’ll have to substitute your names in there… and if you are using a variable to hold onto the filter value you’ll need to do it a little differently…
      If you can give me a few more details and the required names I can probably help you with it…

      HTH

      • #718345

        Here is the whole function:

        PrimaryCR = [Forms]![Corrections Entry]![CR Subform].[Form]![CorrCR]
        RptFilter = “[CorrCR]=” & PrimaryCR
        DoCmd.OpenReport “AdHocCorrectionsListing — New”, acViewNormal, “AdHocCorrectionsListing — New”, RptFilter

        Thanks,
        Bob

        • #718373

          Well first of all, I don’t understand why the Report name is in the Filter argument area of the DoCmd.OpenReport statement, so I’d get rid of that… And second, I believe that you aren’t telling Access that the value is a string… Try this….

          PrimaryCR = [Forms]![Corrections Entry]![CR Subform].[Form]![CorrCR]
          RptFilter = “[CorrCR]='” & PrimaryCR & “‘”
          DoCmd.OpenReport “AdHocCorrectionsListing — New”, acViewNormal, , RptFilter

          Or to simplify…

          DoCmd.OpenReport “AdHocCorrectionsListing — New”, acViewNormal, , “[CorrCR] = ‘” & [Forms]![Corrections Entry]![CR Subform].[Form]![CorrCR] & “‘”

          I haven’t tested this, so let me know how it goes okay? smile
          HTH

        • #718374

          Well first of all, I don’t understand why the Report name is in the Filter argument area of the DoCmd.OpenReport statement, so I’d get rid of that… And second, I believe that you aren’t telling Access that the value is a string… Try this….

          PrimaryCR = [Forms]![Corrections Entry]![CR Subform].[Form]![CorrCR]
          RptFilter = “[CorrCR]='” & PrimaryCR & “‘”
          DoCmd.OpenReport “AdHocCorrectionsListing — New”, acViewNormal, , RptFilter

          Or to simplify…

          DoCmd.OpenReport “AdHocCorrectionsListing — New”, acViewNormal, , “[CorrCR] = ‘” & [Forms]![Corrections Entry]![CR Subform].[Form]![CorrCR] & “‘”

          I haven’t tested this, so let me know how it goes okay? smile
          HTH

      • #718346

        Here is the whole function:

        PrimaryCR = [Forms]![Corrections Entry]![CR Subform].[Form]![CorrCR]
        RptFilter = “[CorrCR]=” & PrimaryCR
        DoCmd.OpenReport “AdHocCorrectionsListing — New”, acViewNormal, “AdHocCorrectionsListing — New”, RptFilter

        Thanks,
        Bob

    • #718326

      Hi Bob…

      Can you show me the DoCmd statement?

      What’s happening is that Access won’t accept a string value in the Filtername argument of a DoCmd.OpenReport statement…
      It wants the name of a saved query that filters as you need it… You can do that if you want… Instead, I normally use the Where condition argument…
      DoCmd.OpenReport “Your Report Name”, acViewNormal, , “[YourField] = ‘CR005464′”
      (Even though it’s optional and not being used, you need to leave the comma in the right place for the filtername argument… )

      You’ll have to substitute your names in there… and if you are using a variable to hold onto the filter value you’ll need to do it a little differently…
      If you can give me a few more details and the required names I can probably help you with it…

      HTH

    Viewing 1 reply thread
    Reply To: Mysterious parameter prompt (Access 2000 SR-1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: