Results 1 to 7 of 7
  1. #1
    AmyT
    Guest

    built-in macro commands

    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

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

    Re: built-in macro commands

    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.
    Charlotte

  3. #3
    AmyT
    Guest

    Re: built-in macro commands

    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!

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

    Re: built-in macro commands

    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.
    Charlotte

  5. #5
    AmyT
    Guest

    Re: built-in macro commands

    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

  6. #6
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: built-in macro commands

    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 [img]/w3timages/icons/doh.gif[/img]

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

    Re: built-in macro commands

    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.
    Charlotte

Posting Permissions

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