• CreateReportControls

    Author
    Topic
    #356065

    Can anyone explain how to programatically change the order of controls created using the CreateReportControl function, in the same way you can in the designer using the Bring To Front / Send To Back menu options?

    Viewing 0 reply threads
    Author
    Replies
    • #526347

      Are you talking about changing their tab order? You can change that when you create the control. You can’t programmatically change their creation order, only create them in the order you want. Could you explain what you’re actually trying to do?

      • #526501

        Charlotte,

        I think no, but the creation of controls on reports is new to me, so …
        What I’m trying to do is reorder certain controls so they are on top of others, e.g. I have some graphic lines that I want to be on top of an image. I’m creating the report controls from data in a table, so I’ve added an order flag, but the how-to do in VBA the same as the menu operation “Bring To Front” is still bugging me.

        Cheers,
        Steve C.

        • #526504

          Have you tried sending the image to the back in design view and making the controls invisible
          untill needed

          • #526510

            Jerry,

            the problem is how to do this using VBA – I can do it manually in the Report Design view, but what I’m trying to do is emulate this process in code. I can’t find any reference to a property which sets the ‘depth’ of the control, I assume it’s implicit to the order in the Controls collection, but I again can’t find a way to re-order the collection.

            • #526511

              instead of send to back or bring to front
              you can make the control visible or invisible
              text1.visible = true or
              text1.visible = false
              HTH

            • #526863

              Jerry,

              not really suitable for all cases – I need to have both controls displaying, e.g. the positioning of lines and graphics is quite tight. The posting by Charlotte suggesting use of the DoCmd.RunCommand acCmdBringToFront looks to be a working solution.

            • #526568

              Maybe I’m missing something here, but why would you WANT to do this from code? What kind of lines are you putting on top and under what conditions? Are we building some kind of wizard here?

              The only way I’ve found to do it is in design view using the DoCmd.RunCommand acCmdBringToFront or DoCmd.RunCommand acCmdSendToBack.

              Setting the visible property of the controls can be done in code in the OnFormat event of the section, but it doesn’t seem like a logical thing to do. Perhaps if you explain what you’re trying to accomplish with your report, we can figure out an answer.

            • #526862

              Charlotte,

              yeap it’s starting to look like a wizard – I’d not planned it to be a fully comprehensive wizard, rather a simple tool for me to use in report generation, but other people have seen it, and …. it’s growing

              Thanks for the tip on the acCmdBringToFront / acCmdSendToBack – I’m now driving the order of creation by a sequence flag in the data table, but it’ll be useful to have a way to adjust after the order after creating a report

              Cheers,
              Steve C.

            • #526864

              Oh forgot to ask
              – purely for interest, do you know where the ‘sequence’ is stored?
              I had a look at the control properties before and after a manual BringToFront / SendToBack but I couldn’t see any change. Ditto I thought it might be the order in the collection, but again couldn’t see anything, so I’m puzzled as to where Access is actually storing the information about the order of controls

    Viewing 0 reply threads
    Reply To: CreateReportControls

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

    Your information: