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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating Unbound Objects

Status
Not open for further replies.

CharlieT302

Instructor
Mar 17, 2005
406
US
Hi folks,

I have an unbound combo box which extracts a company name using a relational query (in the form of an SQL statment in the RowSource).

It's fine. However, I have two other unbound fields: one for phone and one for fax. Both values can be obtained from the same query above.

When I select a company, I would like Access to populate the Phone and Fax fields (unbound) with the correct numbers.

How can this be done?

Thanks

 
Hi, CharlieT,

Use column notation. For instance, in the AfterUpdate event of the combo, you could do something like this:
Code:
Private Sub MyCombo_AfterUpdate()
    Me!MyPhoneNumber = Me!MyCombo.[blue]Column([/blue][red]x[/red])
    Me!MyFaxNumber = Me!MyCombo.[blue]Column([/blue][red]y[/red])
End Sub
...where [red]x[/red] and [red]y[/red] represent the appropriate columns in your combo's SQL. Column notation is zero-based, so the first column is 0, 2nd column is 1, etc.

HTH,

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top