Go Back   Access World Forums > Apps and Windows > VB.NET

 
Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Old 10-06-2013, 11:49 PM   #1
spider2vb
Newly Registered User
 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
spider2vb is on a distinguished road
filter combobox based on another combobox vb.net

Hi ,,
i have problem with combobox
i have two combobox and two tables

table manages (ManageID, ManageName)
table Departments (DeptID, DeptName, Dept_ManageID)

1- CboEmp_Manage
2- CboEmp_Dept



Public Class Class1
Public sub FillCombobox (ByVal cbo As Combobox, ByVal TableName As String , ByVal Col_name As String , ByVal Col_Value As String , ByVal KKR As String)
Try
Dim VarSql As String
VarSql = ""
VarSql = "Select " + Col_name + " , " + Col_Value + " From " + TableName + " " + KKR
Dim sda As New SqlDataAdapter(VarSql , SQLCon)
Dim ds As New Dataset ()
sda.Fill(ds)
cbo.DataSource = ds.Tables(0)
cbo.DisplayMember = Col_name
cbo.ValueMember = Col_Value
Catch

End Try

End Sub

Private Sub CboEmp_Manage_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CboEmp_Manage.SelectedValueChanged

WinClass.FillCombobox (CboEmp_Dept, "Departments WHERE Dept_Manage_ID LIKE '%" & CboEmp_Manage.SelecteIndex.ToString() & "%' " , "Dept_Name", "Dept_ID", "")

End Sub

give me wrong data from table

spider2vb is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter One Combobox based on selection in another combobox rachelkm2 Modules & VBA 4 12-13-2010 09:48 PM
Filter Subform ComboBox based on Master Form ComboBox selection azammalick Forms 1 12-16-2009 12:27 PM
SubForm filter based on a ComboBox Ste4en Forms 3 08-19-2006 04:46 AM
How can I filter one combobox based on another combobox selection? aeleech Forms 2 04-26-2005 08:45 AM
Filter Form Based on Combobox Ian-W- Forms 4 03-08-2004 06:52 AM




All times are GMT -8. The time now is 11:28 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World