• built-in macro commands

    Author
    Topic
    #1768256

    Hello! When designing a macro, I was wondering what the command SortingandGrouping does. I need to have the sorting and grouping window automatically open when the user opens a report…just wondering if this was on the right track!!! Thanks, amy

    Viewing 0 reply threads
    Author
    Replies
    • #1778488

      It does what you suspect, it displays the Sorting and Grouping dialog in the design view of the report. However, you don’t really want to turn your users lose on the design view, at least, not if you still want the report to run. If you explain what you are trying to accomplish, someone may be able to help you get there.

      • #1778552

        Right now I have a command button that the user presses to generate Avery labels. However, it always orders the labels by last name. We would like for it to order the labels the same as the contacts on the form are ordered (sometimes by city, state, etc). Any help to get started would be GREATLY appreciated!!! thanks!

        • #1778602

          How are you changing the order of the records on the form? If you’re using the OrderBy property of the form, assign the form’s OrderBy string to an unbound control on the form with the control’s height and width to 0″ and it’s tabstop property set to False. You won’t be able to see the control on the form, but it will still be visible to the report. In the Open event of the report, set the report’s OrderBy property to the value of the form’s control and set the the report’s OrderByOn property to true. As long as the underlying field names are the same, it should work.

          • #1778950

            Thanks for your help! I think I’m on the right track but just a little confused with your directions because I’m a beginner at this. The form changes the order of the records by the OrderBy property. The underlying field names are also all the same. I was just confused on what the OrderBy string was and how to assign it to the unbound control. If you could just give me more detailed directions i think this is going to work!!! thanks! Amy

            • #1778963

              If you want to store the OrderBy string so you can reuse it, etc., you can use something like this:

              me!txtOrderBy = me.OrderBy

              If you need to reset the OrderBy property later, you can do this:

              Me.OrderBy = me!txtOrderBy
              me.OrderByOn = true

              Your fields and your controls should NOT have the same names. I know that’s how the wizards work, but it is a bad idea all the same. The conventional approach is to give each control a name with a “tag” at the front that identifies the type of control this is. for example, a textbox might be call txtOrderBy, while a comboBox might be called cboOrderBy. Try searching through the Knowledge Base on “naming convention” for more information. The one that MS pushes for VB is different from the one they actually use elsewhere (when they use one at all), but it isn’t as important which convention you use as that you use one and use it consistently. It will make it much easier to decipher your code later on.

        • #1778955

          In design view of the report,
          View/ Sorting/Grouping
          Drag the field you want to sort on first to the top of the window. If all of your data is correct…and THAT’s a HUGE IF…you won’t see any blanks or funky characters when you preview your labels.

          Ex: If you have a field for “city” and you place city as the priority (by dragging the row to the top of the window in [designview/View/Sorting Grouping] it will sort by city.
          If you see blanks or funky characters, open the table, select the column and hit the a-z sort button.

          Warning: Always save a copy of your table before you edit your existing data. That’s always rule 1. ALWAYS!!
          This happens to EVERY beginner

    Viewing 0 reply threads
    Reply To: Reply #1778955 in built-in macro commands

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

    Your information:




    Cancel