ComboBox - DataBinding and Sorting - Days Wasted!

  • Thread starter Thread starter Paul Fairless
  • Start date Start date
P

Paul Fairless

Customers table - contains Columns:
CustID, Surname, Forename, TtlID

Titles table - contains Columns:
TtlID, Title

TtlID is a Foreign Key in the Customers table.

I have a Form frmCustomers which contains a ComboBox to select
the Customer's Title. The ComboBox is populated from the database
table Titles.

However, I want the titles in the combobox to be displayed in alphabetical
order so that when a title is selected and the Customer is updated, the
TtlID field correctly corresponds with that in the Titles table.

I've tried using a dataview and sorting it as the datasource for the
combobox, but once the data value are assigned to the combobox,
the TtlID field gets out of sync with the database table.

How can I solve this? - I've been trying for days!!!

Thank You in Advance for any help.
 
Hello I hope this helps,

Let me explain, first, what I believe you are asking.

You have a Combobox that is populated from a database. When the user
selects a Title you have textboxes (visible or invisible) that are filled
that contain additional information that MUST correspond to the selected
Title. i.e.

This is a different Example:

You have a list of Clients

ComboBox TextBox1 TextBox2

Frank | Address Phone

James | Address Phone

Mark | Address Phone

Marcy | Address Phone

When James is selected the Address and Phone must also be selected and
placed inside TextBox1 and TextBox2.

Am I understanding you correctly. Let me know.

Chuck
 
Hi Charles

Sorry - I do not think we are talking about the same scenario:

Let me try and illustrate:

Database Table contains:

TtlID (PK) TITLE
1 Mr
2 Miss
3 Mrs

But when these are read into the combobox and sorted they become:

TtlID TITLE
0 Miss
1 Mr
2 Mrs

So when I update the database, the TtlID is incorrect!
Does that make sense?

Anyway - Thanks for replying.
 
Hello,

I have notice that another News Group has responded to your question in
Windows Controls. Did their answers solve your problem. If not let me
know, because there is another way using invisible textboxes to carry the
data whereever you wnat using databindings. I have used databindings with a
combobox to carry large amounts of data from multiple tables and multiple
columns based on the selected customer from a combobox.

Chuck
 
Back
Top