Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDisplay one field with a DBCombo control but update another when the user changes the value
KeywordsDBCombo, update field
CategoriesDatabase, Controls
 
Use the properties: BoundColumn, DataSource, DataField, RowSource, and ListField.

In this example, the Companies table holds the names of companies and country codes. The Countries table maps the country codes to country names.

Companies:
    Name
    CountryID

Countries: Name ID

The program must display the Companies table but show the country name instead of its ID. To do that, the following DBCombo control properties were set at design time:

PropertyValuePurpose
RowSourcedatCountriesThe Data control containing the names to be displayed
ListFieldNameThe field in RowSource to display
DataSourcedatCompanyThe Data control holding the values to be updated (in this case, the Companies records)
DataFieldCountryIDThe name of the field in DataSource that we will update

The Data controls' properties are also set at design time to access the appropriate tables. The rest is automatic.

 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated