List Box Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a listbox that is populated with a query I have created in the
row source property. Here is the question. One of the fields is a phone
number. When I open the form with the list box, there is no formatting for
the phone number. I just have 10 numbers with no separators such as () -.
Can someone tell me how to format the query so the phone number appears as a
phone number instead of 10 numbers in a row? Thanks...
 
You will have to put a pretty ugly expression in your query that parses out
the Left-3, right-4 and Mid-4,3 of the 10 digit number...it's will look
something like this at the end:

Phone: "(" & Left(PhoneNumber,3) & ") " & Mid(PhoneNumber,4,3) & "-" &
Right(PhoneNumber,4)

One problem I've encountered with this approach in the past is the issue of
incomplete phone numbers...if your data is very well populated then it likely
will not be an issue, but if there are a lot of phone numbers missing area
codes you might want to put in a couple of IIF's to cover the possibilities
of not having an area code.
 
After reading Don's post I created a new database in Access 97 using the
database wizard to create an Order Entry database. Other than checking the
"Include Sample Data" box, I selected nothing but defaults. Then I created a
form with a List Box based on the Customes table that included 2 fields,
Company Name and Phone No. All the phone numbers display as Don would like.
But if I add a telephone number to the Customer table it displays as he
indicated, no dashes or brackets. Why?

Edward G the Unholy- user of Lookup fields, Send Keys and Unsplit Databases
 
Back
Top