Need advise on operator compatibility using records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

this is my table structure

lower upper price

100 200 $7.20
200 300 $8.10
300 400 $10.90

from here i want to extract the price depend the input limit value

for eg:// if the limit value entered in textbox is 150 .it should
navigate the table
and give the correct price for this limit value.

my code is:

Do Until rstAISI4140NQT.EOF

If Txtlimit.Value <= rstAISI4140NQT("upper") And Txtlimit.Value >=
rstAISI4140NQT("lower") Then


Txtpkg.Value = rstAISI4140NQT("price")


MsgBox (" price calculated ")

Exit Do
Exit Sub


End If

rstAISI4140NQT.MoveNext


Loop

by this code i cannot get the price value..i found frm this code that
operator

"<=" doesnot work in this looping..

plz give me some solution
 
Does it help if you change it to:

If CInt(Txtlimit.Value) <= CInt(rstAISI4140NQT("upper")) And
CInt(Txtlimit.Value) >= CInt(rstAISI4140NQT("lower")) Then

Let me know.

It seems like some data gets misinterpreted. Better make sure all data his
handled as an integer.
 
<= should work, try to debug your code to see what really happens

you can also use query to get this price:
strSQL="Select Price from AISI4140NQT where " & Txtlimit.Value & " Between
upper AND lower"

then open recordset based on this sql and get the price
 
Back
Top