Using MS Access/re-group

Advertisement


Question
QUESTION: I have a table as:
Item  number
A     2
B     3
C     2
A     1
......
My report needs group total numbers as
A&B  6
C    2

How can I do this? Thanks in advance!

ANSWER: You need to create another grouping level. Either in a table or in a function.

Hope this helps,
Scott<>

---------- FOLLOW-UP ----------

QUESTION: Thanks! I am going to create an other table to re group.
  If i like to use a function, what function do i need to use?
Thanks again!

Answer
You would create your own function. Something like:

Public Function MyGroup(strItem As String) As String

Select Case strItem

   Case "A"
      MyGroup = "A&B"
   Case "B"
      MyGroup = "A&B"
   Case "C"
      MyGroup = "C"
End Select
End Function

So you put into your query:

Group: MyGroup([Item])

Hope this helps,
Scott<>

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.