|
-
Jun 27th, 2008, 11:28 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [02/03] Combobox/Textbox help please
Hi people, was hoping someone could offer me some help please. On my form I have two comboboxes and two textboxes, the comboxes and textboxes are linked to a database.
The first combobox and textbox is linked to a customers table, the second combobox and textbox is linked to a caller table. Each customer in the customer table has a CustomerID, this field is also used in the Caller table as 1 customer can have many callers. Now for the complicated part, when the form loads each customers name is loaded in combobox 1, and when a customer is selected from combobox1 in textbox1 the CustomerID is shown. So far I have this working perfectly, however the next part is where I’m struggling.
What I want to do is take the customerID from textbox1, and show all the callers in combobox2 with that same CustomerID, also each caller has their own telephone number so when a caller is selected I want to display the telephone number in textbox 2.
Is this possible? I’ve been struggling a lot on the coding and any help I would appreciate it.
So far I have the following coding which shows the customers in combobox1 and the customer ID in textbox1.
Code:
Dim connection As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Application.StartupPath & "\MS.mdb;Jet OLEDB:Database Password=king;")
Dim adapter As New OleDbDataAdapter("SELECT ID, CusName, CusID FROM Customer ORDER BY CusName", connection)
Dim table As New DataTable
adapter.Fill(table)
Me.cmbcus.DisplayMember = "Name"
Me.cmbcus.ValueMember = "CusID"
Me.cmbcus.DataSource = table
Me.txtcus.DataBindings.Add("Text", table, "CusID")
Please help me as I am stuggling.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|