help me filter with many fields with checkbox

D

dokter.cinta

i have good experience with vb
but i have some serious problems
i have created a mysql with table dss
but i`m confused about this
i think many people will see this problem in future
this is the table of dss

-----------------------------------------------------------------
Date | Drivers | Group | Speed | Score |
-----------------------------------------------------------------
01/01/2006 2111 north 64 98
02/01/2006 2121 north 53 95
03/01/2006 2145 north 43 96
04/01/2006 2187 south 77 94
05/01/2006 2133 north 35 92
06/01/2006 2165 south 38 100
07/01/2006 2181 north 38 80
08/01/2006 2135 north 42 60
09/01/2006 2111 north 43 44
10/01/2006 2124 south 41 85
11/01/2006 2113 north 45 82
12/01/2006 2109 north 75 96
13/01/2006 2106 north 75 99
14/01/2006 2111 north 75 87
15/01/2006 2123 south 90 56
--------------------------------------------------------

then i want select the date from 01/01/2006 until 10/01/2006 with
the driver is 2111 with group north and with speed from 24 until 90
with score from 50 until 100 and show it into datagrid
but i can selected any in checkbox and unselected to show what field i
just wanna filtered

i made date with dtpicker and drivers,group speed and score with
textbox
then i made selected field that i want to filtered with checkbox
this is the details
==================================
check1.value for date
check2.value for drivers
check3.value for group
check4.value for speed
check5.value for score
==================================
date1 = dtpicker1.value
date2 = dtpicker2.value
drivers = txtdrivers.text
group = cbogroups.text (combo box)
speed = txtspeed1.text and txtspeed2.text
score = txtscore1.text and txtscore2.text
==================================
this is a link the picture of the forms
http://www.geocities.com/joanleonz/forms.gif
please help me what kind of code what must i have


please help me? URGENT!


thanks
 
M

Michel Walsh

Hi,


Build the string of the would be SQL statement at run time, testing each
parts, appropriately

if ... then strSQL=strSQL & ....

as


strSQL= "TRUE "
...
...

if checkboxForSpeed then
strSQL=strSQL & " AND speed BETWEEN " & Me.MinSpeed & " AND " &
Me.MaxSpeed
...


The final string must be a valid SQL statement, for sure. Once you have it,
use it to open a recordset or as record source of a form, or as otherwise
appropriate for your case.



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top