Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

[RESOLVED] how to filter in access between numbers

$
0
0
i have a table that holds currency prices

shampo 50 $
hairdryer 70 $

i also have a combobox that i want to filter by numbers

ex. select between 20-40 if i have products that there price are 20,30,40 then i will see it
or 50-90 then i will see the products that have a price of 50,60,70,80,90
Code:

Private Sub CmbPrice_Click()
If CmbPrice.ListIndex = 0 Then Exit Sub
Set rs = CN.Execute("SELECT * from PriceList WHERE PriceCost LIKE '%" & RplS(CmbPrice.text) & "%' ORDER BY PriceCost")
LsVw.ListItems.clear
While Not rs.EOF
  Set itm = FrmPriceList.LsVw.ListItems.Add(, , rs!PriceName, , "price")
  itm.Tag = rs!PriceID
  itm.SubItems(1) = FormatCurrency(rs!PriceCost)
  itm.SubItems(2) = rs!PriceRemarks
  rs.MoveNext
  rs.MoveNext
 Wend
End Sub

Code:

Private Sub Form_Activate()
CmbPrice.AddItem "30-50"
CmbPrice.AddItem "50-100"
End Sub

tnx for the help
salsa31

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>