Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
List1.Clear
If Combo1.Text = "Aerobics" Then
rs.MoveFirst
Do While Not rs.EOF
   If rs.Fields("time") = Combo4.Text And rs.Fields("expdate") > Date Then
      n = n + 1
      List1.AddItem n & "  " & rs.Fields("id") & "   " & rs.Fields("name")
   End If
rs.MoveNext
Loop
End If


my combo4 lists are like sat 1 , sat 2 ...

i have tried f rs.Fields("time") = " sat 1" And rs.Fields("expdate") > Date Then

but i couldn't get the list box..when i tried with different fields with same code its working properly ..i don't know whats the problem with this .any one can help me.
Posted
Updated 15-Apr-13 10:42am
v5
Comments
Maciej Los 15-Apr-13 16:05pm    
I'm little confused ;(
Can't you filter data with recordset object?
zakariyaptpl 15-Apr-13 16:41pm    
sorry ..it my mistake put the heading like that ..i want actually add data on list box from the data base according to the condition that i have mentioned in the code
If rs.Fields("time") = Combo4.Text And rs.Fields("expdate") > Date Then
[no name] 15-Apr-13 17:12pm    
Why don't you filter your data when you query your database then? Then you would not have to do this at all.
zakariyaptpl 15-Apr-13 17:27pm    
sorry i didn't get you actually.....its for a gym to prepare members data base..there is more than one time for Aerobics like sat 1 , sat 2 etc....all these have certain time period. so i want to check for the time sat 1 how many members are there now..so when i click filter i need to get all members list their time as in the combo4 . and the combo4 list are sat 1 , sat 2....
[no name] 15-Apr-13 17:30pm    
What is there "to get"? Filter the data you want when you query your database. You are filtering your data after you already have the data. Just get only the data you want from the database and then you do not have to filter it afterwards.

1 solution

SA - really? Every post bashing vb6???
I use vb6, have been since it was released, actualy started using since vb3, i have 100's of 1000's of lines of code that work just fine and a single app i've been trying to write that would have taken me 2 days in vb6 is now on month 3 in vb.net. I wasn't impressed when .net was released, i'm still not impressed with it now!

zakariyaptpl394, as others have stated, set your filter in your query

Example:
"Select * from {table} where Time='sat 1'"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900