Click here to Skip to main content
13,141,576 members (35,224 online)
Rate this:
Please Sign up or sign in to vote.
See more:
If Combo1.Text = "Aerobics" Then
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
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 9:59am
Updated 15-Apr-13 10:42am
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 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 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 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 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 15-Apr-13 18:16pm
Any particular reason to torture yourself with VB6? :-)
zakariyaptpl 18-Apr-13 6:45am
yup..its already running software I just want to update it.
Sergey Alexandrovich Kryukov 18-Apr-13 10:03am
I'm really sorry for you.
zakariyaptpl 18-Apr-13 10:34am
its k..

1 solution

Rate this: bad
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 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

"Select * from {table} where Time='sat 1'"

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 4 Jul 2013
Copyright © CodeProject, 1999-2017
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