Ji****@datacentricsolutions.com (Jim Allensworth) wrote in message news:<41**************@netnews.comcast.net>...
On 7 Aug 2004 07:50:20 -0700, al****@start.no (Geir Baardsen) wrote:
Use the forms Filter property. You could use a button or the after
update event of the ToDate textbox.
Me.Filter = "InvoiceDate Between #" & Me.FromDate & "# And #" _
& Me.ToDate & "#"
Me.FilterOn = True
You would most likely want to validate the entries before applying the
filter.
- Jim
Hi!
Thank you very much for answering. After a time in a sandbox I found
the following solution:
I have a form and a listbox which is retrieving data in the
form_OnLoad event. So I put
two textboxes, (txtFromDate, txtToDate) and a button, and wrote in the
buttons's OnClick
event:
Private Sub cmdSort_Click()
With Me.lstInvoice
.RowSource = ""
.ColumnCount = 10
.ColumnHeads = True
.ColumnWidths = "2cm;2cm;2cm;2cm;2cm;2cm;3,5cm;2cm;2cm;2cm;"
..RowSource = "SELECT tblOrd.OrdID AS Invoicenr, tblOrd.MyDate,
tblOrd.CustID, tblKunder.Custnr, tblOrd.Printed, tblOrd.Deleted,
tblOrd.DeletedDate, tblOrd.CreditMem, tblOrd.CreditMemnr,
tblOrd.CreditMemDate " _
& "FROM tblCustomer INNER JOIN tblOrd ON tblCustomer.CustID =
tblOrd.CustomerID " _
& "WHERE (((tblOrd.
MyDate) Between Forms!frmMyInvoices!txtFromDate And
Forms!frmMyInvoices!txtToDate));"
End With
End Sub
and of course I have a button that restores the listbox content.