Share via

Grouping Query by Specific Field

Anonymous
2024-11-19T11:46:33+00:00

Good morning!

I'm hoping for some assistance with establishing a specific grouping in an MS Access query. I'm not entirely sure if Access can accommodate what I'm trying to do, but hopeful that it is!

I have a table that is linked to an excel workbook (for the purposes of this post, I'm referring it as Table1). I need it linked so that the notations from the database can update the workbook (IMEX=0 in connection type).

The thing is, there are transactions in this table that have multiple lines and I'm trying to create a query that groups these lines together. For example,

TransactionID Amount Line# Account
T001 (200) 1 1002
T001 (150) 2 1002
T001 300 3 1002
T001 (650) 4 1002
T002 1500 1 1004
T003 3500 1 1005
T003 100 2 1006

But what I'm trying to do is create a user form for users to see all transactions grouped by the TransactionID and Account.

TransactionID Account
T001 1002
Line# Amount
1 (200)
2 (150)
3 300
4 (650)

The only way I can think of doing this is to create a query that groups the data from Table1. However the only way I've been able to group anything is to aggregate the data, but I'm not sure how to go about this since I need to see all rows and columns per each TransID/Account Combination.

Any advice?

Thanks,

Adam

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

10 answers

Sort by: Most helpful
  1. Anonymous
    2024-11-19T13:42:31+00:00

    You do not need to group the query, you can simply order the result table like this:

    SELECT *

    FROM Table1

    ORDER BY TransactionID, Account;

    PS: For a form you could create a parent form based on a query which returns distinct rows:

    SELECT DISTINCT TransactionID, Account

    FROM Table1

    ORDER BY TransactionID, Account;

    and then embed a subform based on the same table, linking the subform to the parent form by setting the LinkMasterFields and LinkChildFields properties of of the subform control to TransactionID;Account.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2024-11-19T16:39:19+00:00

    Howdy!

    Well ideally the users won't be editing the data, but rather adding notations and help ticket information.

    Thanks,

    0 comments No comments
  3. ScottGem 68,810 Reputation points Volunteer Moderator
    2024-11-19T13:41:23+00:00

    Do you need to allow the user to edit the data or just view it? If they only need to view (Note you can't directly update an Excel table from Access), then don't use a form, use a report. In a Report it is easy to group items by multiple fields.

    0 comments No comments
  4. Anonymous
    2024-11-19T13:31:53+00:00

    Howdy, Sophia!

    Thank you! Can you explain how to group them? Because I've tried but cannot figure out how to go about doing this.

    Thanks,

    0 comments No comments
  5. Anonymous
    2024-11-19T13:27:54+00:00

    Hi alandy01,

    To organize your transactions, you can create a query that selects all records and groups them by TransactionID and Account. After setting up the query, you can then generate a Form based on this query.

    To ensure that the form displays all the details for each group, switch the form's Default View to Datasheet. This view will provide a tabular representation of your grouped data, making it easier to review and analyze.

    0 comments No comments