Hello there, How can I print a records which has a date from Combo1.text to Combo2.text

Here is my codes..There are two combobox and I want to do is when the user chose a date like From 1/12/2014 to 1/20/2014 all the records from that dates will be printed only.

Set rx = New ADODB.Recordset
If Combo1.Text = "" And Combo2.Text = "" Then
MsgBox "The boxes are empty!"

Else
With rx
    .Open "select * from tbl_studinfo order by findings asc", con, 3, 3
 If Combo1.Text = .Fields("date") And Combo2.Text = .Fields("date") Then
    Set DataReport20.DataSource = rx
    DataReport20.Sections("section4").Controls.Item("label3").Caption = Date
    DataReport20.Show vbModal
    rx.Close
Else
MsgBox "No Records Available"
    Combo1.Text = ""
    Combo2.Text = ""
    Set rx = Nothing

    End If

End With
End If
 rs.Open "Select * from TABLENAME where COLUMNFORTIME Between #" & Combo2.Text & "# AND #" & Combo1.Text & "#;", con, adOpenKeyset, adLockPessimistic

Perhaps..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.