Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fields of the same record in a combo box 1

Status
Not open for further replies.

pau75

Technical User
Feb 25, 2004
16
US
I'm have a table where each record has three phone numbers (cell, home and work).

I want to create form with some of the information of the table and I would like to combine the three phone numbers in a combo box, so that when you click on it the drop down list shows the three phones. How can I do that?
 
If you wish to show the three phone numbers in a list in a combo, try some code in the Current event for the form. For example:

[tt]Me.[ComboName].RowSource=[Cell] & ";" & [Home] & ";" & [Work][/tt]

You will need to set the Row Source Type to Value List and ensure that the phone number fields are included in the Record Source for the form.
 
How are ya pau75 . . .

[blue]Remou[/blue] has already adressed you problem directly.

My question is . . . [purple]whats the point of selecting phone numbers when you don't know who they belong to?[/purple]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
I think he's speaking of having a record with, for example, a person's name, address, etc, and the having a combobox with cell, home and fax numbers. It'd save a little real estate, I guess.

He might want to add a qualifier so they can differentiate between numbers, i.e.

Me.DocCombo.RowSource = "Home: " & [Home] & ";" & "FAX: " & [Fax] & ";" & "Cell: " & [Cell]

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Oops! Should have said replace DocCombo with your own combobox name!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
missinglinq said:
[blue]I think he's speaking of having a record with, for example, a person's name, address, etc, and [blue]the(n) having a combobox with cell, home and fax numbers.[/blue] It'd save a little real estate, I guess.[/blue]
I agree [blue]missinglinq![/blue]

[blue]The question still remains[/blue] . . . [purple]how is the user to know their selecting the right phone numbers?[/purple]

Calvin.gif
See Ya! . . . . . .
 
What am I missing here, TheAceMan1! The record has the person's name, if they make the simple addition to the combobox I posted, they'll know whether it's the person's cell, home or fax number.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Missling is right, in the form I have some other information (name, Id, etc) and it's all about saving some space in the form (that it is continuous). I tried the code:
Me.DocCombo.RowSource = "Home: " & [Home] & ";" & "FAX: " & [Fax] & ";" & "Cell: " & [Cell]

and it works, the problem is that, now, when I open the form none of the phone numbers is visible until I drop down the list. Any suggestions on how to fix that? I would like to have at least one not null phone visible, either Home, Cell or work...Did I make myself clear??? hope so

By the way, thank you all for the answers!!

 
You can use the current event:

[tt]Private Sub Form_Current()
Me.DocCombo= Me.DocCombo.Column(0, 0)
End Sub[/tt]
 
Doesn't work, when I tried, all the records are showing the same phone number. It's a continuous form, I guess it's the reason why. Right?
 
It is always wise to mention that you are using a continuous form. I suggest you include just the most important number on the form and use a small pop-up form to show the other numbers, when required. If you feel like a challenge, you can use the Controltip Text.
 
Thanks for the tip. I'll probablty use the pop up form. Just one more thing, what's a controltip text??
 
ControlTip Text is a property of form controls. You will find it under Other on a tabbed property sheet. It is a little message that will pop-up when you hover over a control, and very useful it is too.
 

As Remou said, it's always wise to mention that you are using a continuous form. Most of the rules are different for this type of form. Having the combo box loaded with the numbers for a given record will require Access knowing which record you're interested in. The only way I could get it to work for a continous form was to place the combo box in the form header; I placed it between the headings and the data. I added Remou's line to make the first number show, rather than a showing a blank. The combo box will show the numbers for whichever record has the focus at the time.

Code:
Private Sub Form_Current()
  Me.DocCombo.RowSource = "Home: " & [Home] & ";" & "FAX: " & [Fax] & ";" & "Cell: " & [Cell]
  Me.DocCombo = Me.DocCombo.Column(0, 0)
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top