473,416 Members | 1,566 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,416 software developers and data experts.

Multiple PHone Numbers

My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables - client
and phone linked by client id

right now I get
contact a - phone number 1
contact a - phone number 2

I would like
contact a - phone number1, phone number 2
Jun 27 '08 #1
7 3848
This can be done via a cross tab query. I think you will need to
query for one more additional data than just name and phone, as the
crosstabs require 3 fields. Here is an example of what i did with
Name, Phone, and Type (cell, work etc)

New Crosstab query wizard. Choose your table OR a query that pulls
the info fields you need.

Row Header = [Name]
Column Header = [Type]
Choose "First" for the function on the [Phone] Field.

Uncheck the box for "Yes, Include row sums".
Then that should do it for you.
Jun 27 '08 #2
On Jun 10, 8:46*am, Propoflady <cha...@monticule.comwrote:
My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables - client
and phone linked by client id

right now I get
contact a - phone number 1
contact a - phone number 2

I would like
contact a - phone number1, phone number 2
what is the structure of your data, how many tables
Jun 27 '08 #3
You need to create a function, Function StrTelephoneNumber(ClientID) As
String that creates a string of the multiple telephone numbers for a given
Client ID and then put the function in a standard module. Then you base your
form or report on a query and in an empty field of the query you put:
ClientPhoneNumbers:StrTelephoneNumber(ClientID).

Steve

"Propoflady" <ch****@monticule.comwrote in message
news:c9**********************************@l64g2000 hse.googlegroups.com...
My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables - client
and phone linked by client id

right now I get
contact a - phone number 1
contact a - phone number 2

I would like
contact a - phone number1, phone number 2

Jun 27 '08 #4
You will need a query which calls a function to retrieve the numbers

In the query based on Clients you probably will have
ClientLastName, ClientFirstName, ClientID
Add a Field PhoneNos(ClientID)
I assime you have a table called "Phones" with ClientID and PhoneNo

Then in a module Air Code

Option Explicit
Option Compare Database

Function PhoneNos(ClientID as long) As String

Dim MyDb as database
Dim PhoneSet as RecordSet
Dim SQLStg as string, PhoneStg as String

SQLStg = "SELECT Phones.* FROM Phones WHERE ClientID = " & ClientID

Set MyDb = currentDb
Set PhoneSet = Mydb.OpenRecordset(SQLStg)

With PhoneSet
Do until .EOF
PhoneStg = PhoneStg & !PhoneNo & ", " ' Add a comma &
space
. MoveNext
Loop
.Close
Set PhoneSet = Nothing
End With

PhoneNos = Left(PhoneStg, Len(PhoneStg) -2) ' Remove last comma &
space

exit function

HTH

Phil
"Propoflady" <ch****@monticule.comwrote in message
news:c9**********************************@l64g2000 hse.googlegroups.com...
My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables - client
and phone linked by client id

right now I get
contact a - phone number 1
contact a - phone number 2

I would like
contact a - phone number1, phone number 2

Jun 27 '08 #5
Propoflady <ch****@monticule.comwrote:
>My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables - client
and phone linked by client id
If you only need them on a report then consider a multi-column subreport.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Jun 27 '08 #6
On Tue, 10 Jun 2008 07:46:43 -0700 (PDT), Propoflady <ch****@monticule.com>
wrote:
>My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables - client
and phone linked by client id

right now I get
contact a - phone number 1
contact a - phone number 2

I would like
contact a - phone number1, phone number 2

Put a txt box in your report. Set the width of the box to the maximum your
report can use. Delete the label that goes with the box.
For the control source of the txt box use:

=[contact a] & " - " & iif([phone number 1] is not null, ", " &[phone number
1], "") & iif([phone number 2] is not null, ", " &[phone number 2], "") &
iif([phone number 3] is not null, ", " &[phone number 3], "") & iif([phone
number 4] is not null, ", " &[phone number 4], "")

etc, etc, etc

Just be sure there is sufficient horizontal space in your report. This will
not move any other controls to the right of the phone numbers. If you set the
width of the txt box to something less than what is needed for all the numbers
and allow the box to grow, you will be right back to where you are now, which
you don't want.

As you can see. Many ways to skin a cat. And they will all get you to where
you want to be.

Chuck
--
Jun 27 '08 #7
Propoflady <ch****@monticule.comwrote in
news:c9e72023-ad32-4cf6-aea9-efe31c23ea67
@l64g2000hse.googlegroups.co
m:
My contacts can have as many as five or six phone numbers - is it
possible to make a query that puts the name, and each phone number
after it on the same line - for this reason I have two tables -
client and phone linked by client id

right now I get
contact a - phone number 1
contact a - phone number 2

I would like
contact a - phone number1, phone number 2
Dev Ashish has published the fConcatChild function to do exactly
what you want.
http://www.mvps.org/access/modules/mdl0004.htm

--
Bob Quintal

PA is y I've altered my email address.
** Posted from http://www.teranews.com **
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: joemono | last post by:
Hello everyone! First, I appologize if this posting isn't proper "netiquette" for this group. I've been working with perl for almost 2 years now. However, my regular expression knowledge is...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
4
by: Brian Henry | last post by:
I have phone numbers like this in a data table 123-435-1234 1231231234 432.234.2321 they all have different formatting, what I want to do is get them all formatted like this (123) 123-1234
2
by: Howard | last post by:
how would you design a table that allows an item to belong to multiple parent categories. single parent example: select * from table1 where parentid = 5 in this case parentid is an indexable...
10
by: JackM | last post by:
I'm still working on validating the phone numbers that are entered on a form but have come across a problem I don't understand how to fix. I can handle most instances when it's in regular US...
4
by: lilOlMe | last post by:
I'd love to be able to validate phone numbers in my software but my product is being used world wide. Not everyone's phone number is formatted like USA/Canada formats theirs. I've found a few...
5
by: lim4801 | last post by:
I am currently in doing a program which is given by my tutor: Contemplate that you are working for the phone company and want to sell "special" phone numbers to companies. These phone numbers are...
4
by: Blue Streak | last post by:
Hello, Folks! Does anyone know of a website that lists the local phone number formats for each country? TIA...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.