|
-
Jun 29th, 2010, 07:11 AM
#1
Thread Starter
New Member
fill combo boxes using ado database
i am using three combo boxes such as
cmb_class,cmb_div and cmb_rno.
i have done with filling the combo indivisually.. but i want user to select the class first.
then the list should be generated in div (i.e. division) combo according to class.
Means, if 5th class having 4 divisions it will show same and so on..
help me...
thnks inadvnce
-
Jun 29th, 2010, 07:46 AM
#2
Re: fill combo boxes using ado database
Welcome to VBForums 
As you have left out lots of details (such as the language you are using, your code, the table/field details, etc) we can't be precise, but what you want is an SQL statement like this:
Code:
strSQL = "SELECT div FROM division WHERE class = '" & cmb_class.Text & "'"
..which you would use to load the data in the second combo when an item is selected in the first.
-
Jul 1st, 2010, 11:49 AM
#3
Thread Starter
New Member
-
Jul 1st, 2010, 12:01 PM
#4
Re: fill combo boxes using ado database
You should be able to work that out yourself (or at least get close to it) based on my example... give it a try
-
Jul 1st, 2010, 12:20 PM
#5
Thread Starter
New Member
Re: fill combo boxes using ado database
i tried an sql statement for it with AND but it is givng error msgs like Typemismatch or No Value given for one or more parameters required....
one of the statements i used was
___________________________________________________________________________________
cmd.CommandText = "Select STD_INFO.* from STD_INFO where [Std_Class]= " & CMB_CLASS.Text And " [Std_Division]= ' ' " & CMB_DIV.Text
___________________________________________________________________________________
STD_INFO is table name, and i am using db access 2000(.mdb) with adodb.connection
-
Jul 1st, 2010, 12:28 PM
#6
Re: fill combo boxes using ado database
Is Std_Devision a text field in the database? Why do you have an open and close text deliminator in the query and then append a text value after that?
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Jul 1st, 2010, 12:35 PM
#7
Thread Starter
New Member
Re: fill combo boxes using ado database
finally i hav don with this as:
Code:
Private Sub cmb_div_click()
rst.MoveFirst
If rst![Std_Division] = CMB_DIV.Text Then
CMB_RNO.AddItem rst![Std_Roll_Num]
End If
End Sub
i.e. it fills only those items(roll numbers) from an open recordset where the division is equal to CMB_DIV.text..
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
|