473,394 Members | 1,889 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.

Concatenating fields

I have 1 table with multiple fields

Unit First Name Last Name # Pets Pet's Name
100 John Jackson 1 Oreo
200 Peter Smith 2 Molly and Candy
200 Elaine Smith 2 Molly and Candy
300 Susan Smith 2 Molly and Candy
400 Nedd White 1 Blake

I want to be able to print a report with all the pets and their owners but I dont want to have a specific pet listed more than once in the report.

I believe I need to concatenate but Im not so sure, I need help.

I would really like the Pet's Name column to be grouped so I can get a result such as the following.

Unit Full Name # Pets Pet's Name
100 John Jackson 1 Oreo
200 Peter, Elaine and Susan Smith 2 Molly and Candy
400 Nedd White 1 Blake
Nov 24 '06 #1
2 1317
NeoPa
32,556 Expert Mod 16PB
I have 1 table with multiple fields

Unit First Name Last Name # Pets Pet's Name
100 John Jackson 1 Oreo
200 Peter Smith 2 Molly and Candy
200 Elaine Smith 2 Molly and Candy
300 Susan Smith 2 Molly and Candy
400 Nedd White 1 Blake

I want to be able to print a report with all the pets and their owners but I dont want to have a specific pet listed more than once in the report.

I believe I need to concatenate but Im not so sure, I need help.

I would really like the Pet's Name column to be grouped so I can get a result such as the following.

Unit Full Name # Pets Pet's Name
100 John Jackson 1 Oreo
200 Peter, Elaine and Susan Smith 2 Molly and Candy
400 Nedd White 1 Blake
You seem to want to handle this as a double many-to-many relationship.
Also, you're trying to force multiple items in an innapropriate record structure.
This is not good.

You should consider setting up separate tables for owners and pets.
However, concatenating multiple records into a single string is not easily supported.
You could produce results in a column if required.
Again, you have a real problem listing owners per unit AND pets per unit in the same result set.

I'm sorry that most of what I say is explaining what's wrong and what you CAN'T do.
Let's see what other contributors come up with.
Nov 24 '06 #2
MMcCarthy
14,534 Expert Mod 8TB
The first problem you have is that you have one table where you actually need three.

tblOwner
Unit (PK - Assuming only one unit per owner and only one owner per unit)
FirstName
LastName

tblPet
PetID (PK and AutoNumber)
PetName

tblPet_Owner
Unit (PK)
PetID (PK)

The second thing is you can't do the report you are trying to do with one report. You would need to use a subReport to show Pet Information).


I have 1 table with multiple fields

Unit First Name Last Name # Pets Pet's Name
100 John Jackson 1 Oreo
200 Peter Smith 2 Molly and Candy
200 Elaine Smith 2 Molly and Candy
300 Susan Smith 2 Molly and Candy
400 Nedd White 1 Blake

I want to be able to print a report with all the pets and their owners but I dont want to have a specific pet listed more than once in the report.

I believe I need to concatenate but Im not so sure, I need help.

I would really like the Pet's Name column to be grouped so I can get a result such as the following.

Unit Full Name # Pets Pet's Name
100 John Jackson 1 Oreo
200 Peter, Elaine and Susan Smith 2 Molly and Candy
400 Nedd White 1 Blake
Nov 25 '06 #3

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

Similar topics

1
by: Bert | last post by:
In a select query I am attempting to combine two fields: One where Field1 = "AL" the other Field2 = "01" I am writing: NewString = & Even though Field2 is a string, the leading zero...
16
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
4
by: ghadley_00 | last post by:
I have an access database form where I have a button that is supposed to be appending the contents of 1 memo field to another is behaving non-predictably. The code is: Me! = Me! & Chr$(13) &...
0
by: bob brar | last post by:
hi, I have the following function in a class. Public Function getCustomers() As DataSet Dim Db As New CDatabaseAccessor getCustomers = Db.getData("SELECT A.*, RTRIM( A.TITLE)+', '+ RTRIM...
4
by: Elena | last post by:
Hi, I am filling in a combobox. I would like to concatenate two fields into the data combo box and display "last name, first name" I tried to displaymember = "employee_last_name" & ", " &...
5
by: john | last post by:
In a query I have the fields Letter, Prefix, and Surname. I need to make a report in which there is one field called Name which is a concatenation of the three fields. When I do this: Expr2: +"...
5
by: JRNewKid | last post by:
I want to concatenate two fields on a report. They are two text fields, wrkDescription is 10 characters long and wrkTextDescription is 255. I have them concatenated in the report but I'm only...
12
by: DThreadgill | last post by:
I have 1 table with 2 fields, Account and Comments-no primary key as the account can be the same multiple times Account Comment 12345 Good Work! 12345 ...
1
by: Tamer Ibrahim | last post by:
Hi, I have two different text boxes. One is for reading user input date and the other is for reading user input time. How can concatenate both of the two fields and save them as one data value to...
2
by: Whizzo | last post by:
Hi all; I'm using this great bit of code to concatenate a fields from multiple rows into a single one. 'Concat Returns lists of items which are within a grouped field Public Function...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.