• Macro problem

    Author
    Topic
    #356088

    I’d appreciate some advise please on this “problem”:
    Background – database written in A97 and recently converted to A2000.
    We have a report that requires 3 parameters, 1 is [style], 2 is client’s and 3 is [year].

    The report is called by a macro (which used to work perfectly) and this is what shows on screen

    Enter Parameter Value Style of Accounts (I would enter draft, then press OK)

    Enter Parameter Value Please enter Clients Code], 2 [Unknown]= (so I enter a clients code, press OK)

    Enter Parameter Value Style of Accounts (now here I enter a year say 2001, press OK)

    Enter Parameter Value Please enter Clients Code], 5 [Unknown]= (just press enter)

    Report opens as it should at the correct record and with correct data! The macro uses a where condition in the open report which is [secode]=[Enter Client's Code] And [TrYear]={Enter Year ending]. So why do I get the screwed up messages in the Enter Parameter boxes?

    Viewing 0 reply threads
    Author
    Replies
    • #526439

      First off, can we clarify terminology? You can call a report from a macro or from code, which isn’t the same thing in Access, so which one are you talking about? Are the parameters in the underlying query or are you capturing in put in code? Why don’t you post the relevant code (if that’s what we’re talking about) and maybe someone can spot the problem. If the parameters are in a query, post the SQL for the query.

      • #526526

        Ooops, sorry Charlotte, I will clarify:
        The report is based on a query, the query has no filters whatsoever. The macro calls the report and in the macro where condition is [Code]=[Please enter client’s code]and [Year]=Please enter Year ending].

        After reading your reply, I tried to enter these two criteria into the query and got the same result as from the macros. Incidentally, the field {code] is alphabetic and [Year] numeric.

        • #526562

          Wait, are these in the macro condition column or in the where condition for the OpenReport action? And what do you mean by this[indent]


          So why do I get the screwed up messages in the Enter Parameter boxes?


          [/indent]You told us what the screen displayed, so what message is wrong and what’s wrong with it?

          • #526614

            The where condition is in the macro action column of the OpenReport Action.

            The Where condition reads: =[please enter clients code] and [Year]=[Please enter Year ending]

            When this macro is run the Enter Parameter Value box pops up and requests client's code then another EPV box requests for a style, lastly the 3rd EPV box states (where it should request a Year & here's the error message) Please enter clients code], 3 unknown=

            • #526643

              Macros are VERY bad at handling parameters, so you’ve been lucky to make it work in the past. The condition is intended to control execution of the macro, not to pass arguments to anything else. How are you passing the condition to the report?

              All three of the parameters are in the same condition espression, right? So where is the [style] parameter? I don’t see it in what you posted. Just copy the whole condition expression from your macro and paste it into your post, then we can start from the same point.

    Viewing 0 reply threads
    Reply To: Macro problem

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

    Your information: