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

Problem Filter Year with Between

$
0
0
Dear Expert,
I have try to Filter year using Between in query, but it fails to Filter it still display the year from the first combo i choose when both combo box is activated.
Kindly point me the mistake and guide how to correct it. I have attached the File sir. Also Here is the code where i use for filter the year using Between.

Code:


If YearFromCheck.Value = 1 & YearUptoCheck.Value = 1 Then
          ComboFrom.Enabled = True
          ComboUpto.Enabled = True
         
        rsview.Open "SELECT DateofBirth FROM test where Year(DateofBirth) BETWEEN '" & ComboFrom & "' AND '" & ComboUpto.Text & "'", con, adOpenStatic, adLockOptimistic
       
                            If rsview.BOF = True Or rsview.EOF = True Then
                                MsgBox " No Record Found  :  " & Me.ComboFrom.Text, Me.ComboUpto.Text
                                    ComboFrom.Clear
                                    ComboUpto.Clear
                                        Exit Sub
                                Else
               
     
               
                Do Until rsview.EOF = True
               
                    Set LI = ListView1.ListItems.Add(, , rsview(0))
                        ListView1.Refresh
                    For x = 1 To 8
                                               
                        LI.SubItems(x) = rsview(x)
                       
                    Next x
                   
                    rsview.MoveNext
                Loop
               
                End If
              End If
             
    'rsview.Close
    'con.Close
    'Set rsview = Nothing
    'Set con = Nothing

Attached Files

Viewing all articles
Browse latest Browse all 21273

Trending Articles



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