Results 1 to 2 of 2

Thread: Greater and Lower Question!!

  1. #1

    Thread Starter
    Hyperactive Member Tequila_worm's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    344

    Greater and Lower Question!!

    Ok i really dont know what is wrong with me tonight. but this doesnt see to work. take a look at this

    VB Code:
    1. Private Function Search(iMin As Integer, iMax As Integer)
    2.    
    3.    
    4.     Do Until Adodc1.Recordset.EOF
    5.         If txtPrice.Text >= iMin & txtPrice.Text <= iMax Then
    6.             lstDisplay.AddItem txtHomeMLS.Text
    7.         End If
    8.         Adodc1.Recordset.MoveNext
    9.     Loop
    10.     If lstDisplay.ListCount = 0 Then
    11.         MsgBox "No records found"
    12.         Adodc1.Recordset.MoveFirst
    13.         Exit Function
    14.     End If
    15.    
    16. End Function

    Ok now i have a few numbers is lookin at they are 198, 345, 230 now i put in so that the iMin = 10 and iMax = 10

    but it displays all of them. Dam can somone plz tell me if i am doin something wrong, because i just blacked out and cant see any errors lol. Thx

  2. #2
    gaffa
    Guest
    Change the ampersand to be "AND"

    You are casting the equality checks to string and then concatentating them.

    VB Code:
    1. 'Change
    2. If txtPrice.Text >= iMin & txtPrice.Text <= iMax Then
    3. 'To
    4. If txtPrice.Text >= iMin And txtPrice.Text <= iMax Then

    - gaffa

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width