472,958 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Combine multi-value field in Report

I have two tables

The first, MainTBL, has the following fields:

ID [Primary Key]
DefFIRST [text field]
DefMI [Text field]
DefLAST [Text field]
DefSUF [Text field]
DefDOB [Date/Time field]
Charge [Number - lookup field]
and several other fields.

The second table, ChargesTBL has the following fields:

ChargeID [Primary Key]
ID [number - linked to MainTBL]
Charge [Text]

The Charge field in ChargesTBL can hold many different values for each person in the MainTBL.

I would like to create a report that is grouped by DefLast, and lists all of the values of the charge field in a text box, separated by a comma.

The reports I've currently created list each charge on a separate line.

Thanks in advance.
May 5 '15 #1
8 4467
zmbd
5,501 Expert Mod 4TB
lineone
Unless you are creating a webapp/sharepoint site I highly advise that you change your lookup field
[Charge [Number - lookup field]]
to a plain numeric and here is why:
The Evils of Lookup Fields in Tables

You can and should normally create your lookup fields within either a query or form.

Set up your table relationships via the Database tools.
(if in ACC2013 you can get at this from the table design view too)

As for what you are asking, I assume you mean something like what is shown in the post >here< for the example report.

Once you have your relationships setup properly, you can build a query that pulls the main table and related table(s), verify the relationships are correct, and return the fields of interest. You might open the database referenced in the above post and follow the instructions there to see how the report is constructed.

Let us know how you progress...
May 5 '15 #2
ZMBD,

Thanks much for your prompt reply. I'm still a bit stumped (I'm new at this), and believe that I may not have describe how I actually setup the tables and relationships. I've included the database in the hope you can guide me through my inexperience. I'm using Access 2013 but saved this in the 2003 version to make it more accessible. Again, thanks for all you've done.
Attached Files
File Type: zip Access2003-DRC2015.zip (930.8 KB, 102 views)
May 6 '15 #3
zmbd
5,501 Expert Mod 4TB
I'll send you a copy of my "tool kit" via PM

You may also find the following to be useful if you are having trouble creating your relationships:
How to define relationships between tables in an Access database

This describes a lookup field: Create a lookup field which I personally avoid as noted in my first reply. :)
May 6 '15 #4
Thanks, ZMBD.

I was wrong about my Charge field being a lookup; it is indeed a numeric field. It seems I'm merely having a problem creating a report that will put all of the values from ChargesTBL.Charge into a text box, with each charge separated by a comma rather than a new line. I didn't explain myself very well. A JPG is attached showing my relationship between the two tables.

Thanks, again

My original post should have read:

I have two tables

The first, MainTBL, has the following fields:

ID [Primary Key]
DefFIRST [text field]
DefMI [Text field]
DefLAST [Text field]
DefSUF [Text field]
DefDOB [Date/Time field]
Charge [Number]
and several other fields.

The second table, ChargesTBL has the following fields:

ChargeID [Primary Key]
ID [number - linked to MainTBL ID Primary Key]
Charge [Text]

The Charge field in ChargesTBL can hold many different values for each person in the MainTBL.

I would like to create a report that is grouped by DefLast, and lists all of the values of the charge field in a text box, separated by a comma.

The reports I've currently created list each charge on a separate line.

Attached Images
File Type: jpg Relationship.jpg (28.6 KB, 1711 views)
May 6 '15 #5
zmbd
5,501 Expert Mod 4TB
Ok, you'll need a tad of code.
Before I potentially lead down the wrong path, let me repeat things:

Currently you have something like:
Expand|Select|Wrap|Line Numbers
  1. Family PK - Family Name - - Retreat Name
  2. 1           Alpha           Annunciation
  3.                             Dummy Data Rulles
  4.  
  5. 2           Beta            Annunciation
  6.                             Getting to know your spouse
  7. ...
  8. 15          November        Nativity
  9.                             (etc...)                             
Instead you would like:
Expand|Select|Wrap|Line Numbers
  1. Family PK - Family Name - - Retreat Name
  2. 1           Alpha           Annunciation, Dummy Data Rulles
  3.  
  4. 2           Beta            Annunciation, Getting to know your spouse, 3rd, 4th, etc...
  5. ...
  6. 15          November        Nativity, 2nd, 3rd, 4th, etc...
  7. (etc...)
May 6 '15 #6
Yes, ZMDB, I couldn't have illustrated it better. Thanks.
May 6 '15 #7
zmbd
5,501 Expert Mod 4TB
Ahh... I have a function built for that... but it is on the toasted-pc... arrrgghh/

If I can find my backup I'll post


The concept is to build a custom function.
It opens a record set that loops thru the related records based on the current record and builds the string then returns it.

I am pretty sure we've covered this exact thing about a year or so ago...
May 6 '15 #8
NeoPa
32,547 Expert Mod 16PB
Combining Multiple Rows of one Field into One Result has an example of such a function.
May 7 '15 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: tina.boroff | last post by:
I didn't know what to use as a title for this. Here is the scenario: I have a op.reqedit.php page. This page a form where you input data. In this page I have split a MySQL field. It is called...
2
by: Paolo | last post by:
I have a field called Order No, I want its value to be a combination of this string "P000" and the value of the . I tried this: = Or = "P000" If I want to combine the two values what...
7
by: BillCo | last post by:
taking the following data: a w a n b r b y b p c a getting the following result from a query:
1
by: heckstein | last post by:
I am working in Access 2002 and trying to create a report from our company's learming management system. I am not a DBA and most of my SQL knowledge has been self taught through trial and error. I...
5
by: terbolee | last post by:
I have a text field and a dd/mm/yyyy field. My third field needs to be automatically filled in with the first 3 chars of and mmdd of the field. Here's an example: "CASTOR" in & 15/01/2007...
1
by: yovation | last post by:
Hello, I have a 3 table product database. 1) Products (Parent) 2) Attributes (Child) 3) Options (Child of Child (Attributes)) Here is the problem I am having.
5
by: varshaP | last post by:
Hi.. How to remove selected value from a readonly multivalue field, on clicking the button ?
1
by: beemomo | last post by:
Hi everyone there, i am facing the problem with using the SQL condition --LIKE in a multi value field of my access 07 table. I have a multi value field which store a number of keywords for a...
8
by: clloyd | last post by:
I have a report that loops through multiple records to combine one field with multiple results into one record. The code is as follows: Private Sub Report_Open(Cancel As Integer) Dim...
11
by: hvsummer | last post by:
] Hi everyone, This is my first topic, clap clap clap when a lot of people think that Multivalue Field will break database normalization rule, that's not correct. first thing, to understand...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.