Results 1 to 6 of 6
  1. #1
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7

    Group Header


    I'm a beginner at Access, so bear with me here.

    I have many different categories under my "Facility Type" field and have separated them into separate groups. It's something like this (but many more):

    Commercial - Banks
    Commercial - Offices

    Educational - High
    Educational - Elementary

    Residence - Multi

    I want to display "Commercial" "Educational" and "Residence" respectively as my text that shows up under the Group Header. Access gives me the option of whole field, 1 letter, 2 letter, 3 letter, etc.
    Whole field won't work because I don't want to see the " - Banks". By letter number doesn't work, because the different words have different numbers of letters in them.
    What I want to know is if there is an option to show the just the first word.
    If not, any suggestions?
    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If they consistently follow that pattern, you could add a field to the query using the Left() and InStr() functions, and use that. InStr() to find the position of the first space (or the hyphen).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7
    If they consistently follow that pattern, you could add a field to the query using the Left() and InStr() functions, and use that. InStr() to find the position of the first space (or the hyphen).

    Okay, I think I understand how I would use those two functions - I'd basically be creating a new field with just the first words, correct?
    However, once I do that, how would I turn that field into my headings? I don't want to change the actually groups - I need to keep those as they are.
    Also - super n00b question - once I add a field in my query how can I add that field to my existing report without starting over?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Once you add a field to the query it will be available to be used on the report. You can change the control source of an existing textbox to it or add a new textbox. If adding that field to the query changes the result in some way, another alternative is to leave the existing field in Sorting and Grouping, but to use those functions in the textbox instead of the actual field name (=Left(...))
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7

    Success =]

    I got it to work! Thank you so much for the kind and timely assistance!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. query group by over another group by?
    By gap in forum Queries
    Replies: 2
    Last Post: 07-04-2011, 12:59 AM
  2. Replies: 3
    Last Post: 01-13-2011, 03:53 AM
  3. Replies: 5
    Last Post: 11-29-2010, 08:16 AM
  4. report header
    By nashr1928 in forum Reports
    Replies: 2
    Last Post: 07-13-2010, 12:34 PM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums