Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6
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 15-Apr-13 10:59am
Edited 15-Apr-13 11:42am
v5
Comments
Maciej Los at 15-Apr-13 16:05pm
   
I'm little confused ;(
Can't you filter data with recordset object?
zakariyaptpl at 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
ThePhantomUpvoter at 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 at 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....
ThePhantomUpvoter at 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.
Sergey Alexandrovich Kryukov at 15-Apr-13 18:16pm
   
Any particular reason to torture yourself with VB6? :-)
—SA
zakariyaptpl at 18-Apr-13 6:45am
   
yup..its already running software I just want to update it.
Sergey Alexandrovich Kryukov at 18-Apr-13 10:03am
   
I'm really sorry for you.
—SA
zakariyaptpl at 18-Apr-13 10:34am
   
its k..

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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'"
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 210
3 Afzaal Ahmad Zeeshan 204
4 CPallini 185
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 4 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100