473,587 Members | 2,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3865
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...@monticu le.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 StrTelephoneNum ber(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:
ClientPhoneNumb ers:StrTelephon eNumber(ClientI D).

Steve

"Propoflady " <ch****@monticu le.comwrote in message
news:c9******** *************** ***********@l64 g2000hse.google groups.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(Client ID)
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(Client ID 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.OpenRecord set(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****@monticu le.comwrote in message
news:c9******** *************** ***********@l64 g2000hse.google groups.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****@monticu le.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****@monticu le.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****@monticu le.comwrote in
news:c9e72023-ad32-4cf6-aea9-efe31c23ea67
@l64g2000hse.go oglegroups.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
19215
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 pretty limited. I wrote the following expression to take (hopefully) any _reasonable_ phone number input, and format it as (999) 999-9999 x 9999.
0
2688
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 form. Then I have 3 pages on a tab control ( 4 if the type of candidate validates that is is to be shown) Each page has a subform. The subforms can...
32
14801
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 ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
4
4539
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
1295
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 unique integer possible multiple parent: select * from table1 where parentid = '5,6' a problem is that i don't know the order of the ids it could...
10
14290
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 formats (555-555-5555 or (555) 555-5555 or 555 555 5555) but I'm having trouble when the entry is ten consecutive numbers with nothing else (5555555555)....
4
3138
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 sites that told me how international phone numbers are formatted and can figure out how to validate them quite easily from that... But it doesn't...
5
3286
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 "special" because they are easily translated into words. You've been asked to create a list of phone numbers that are directly mappable to words by...
4
2511
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...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8205
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.