jgoodman00
Programmer
- Jan 23, 2001
- 1,510
I am trying to implement bound combo boxes for a data form.
I have created a dataset with the required data & lookup tables. I have created the required relationships.
I then added a combo box to my form:
For DataSource I specified my lookup table.
For DisplayMember I specified the 'text' column for my lookup table.
For ValueMember I specied the ID column for my lookup table.
Under data-bindings, SelectedValue I specified the datacolumn in my main table.
N.B. The form was created using the data-form wizard.
Now, when I load the form it is bound correctly, & if a value is present it displays correctly, changing as records are navigated. However my problem occurs when I attempt to update a value:
The value entered updates correctly & is inserted into the underlying table. However, when I navigate to the next record, if no value is present, the combo seems to default to the first entry in the list, rather than being null. Also, if I remove the value for a record & then update (using UpdateDataSet), the combo will again default to the first value in the list rather than null.
Any suggestions?
James Goodman MCSE, MCDBA
I have created a dataset with the required data & lookup tables. I have created the required relationships.
I then added a combo box to my form:
For DataSource I specified my lookup table.
For DisplayMember I specified the 'text' column for my lookup table.
For ValueMember I specied the ID column for my lookup table.
Under data-bindings, SelectedValue I specified the datacolumn in my main table.
N.B. The form was created using the data-form wizard.
Now, when I load the form it is bound correctly, & if a value is present it displays correctly, changing as records are navigated. However my problem occurs when I attempt to update a value:
The value entered updates correctly & is inserted into the underlying table. However, when I navigate to the next record, if no value is present, the combo seems to default to the first entry in the list, rather than being null. Also, if I remove the value for a record & then update (using UpdateDataSet), the combo will again default to the first value in the list rather than null.
Any suggestions?
James Goodman MCSE, MCDBA