473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 4503
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, 103 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, 1786 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,556 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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.