Results 1 to 2 of 2
Thread: Date Search on a Form (2000)
2004-07-24, 18:01 #1
- Join Date
- Jan 2001
- Alzano Lombardo, Italy
- Thanked 0 Times in 0 Posts
Date Search on a Form (2000)
The Command51 button on the Prev form(please see attachment) allows me, once a date has been selected on the calendar, to display the record for that date as the first record on the form. Problem is, since I achieve this by filtering the form, I lose the visibility of all the records of an earlier date.
How can I search for a date on the form and still be able to see all the records?
2004-07-24, 18:27 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: Date Search on a Form (2000)
Instead of filtering the form, you can let the command button perform a search. The following code is derived from the code generated by the Combo Box Wizard if you specify the option to look up a record.
Private Sub Command51_Click()
Dim rst As Object
On Error GoTo Err_Command51_Click
Set rst = Me.Recordset.Clone
rst.FindFirst "<!t>[Giorno]<!/t> >= #" & Format(Me!CGior, "mm/dd/yyyy") & "#"
If Not rst.EOF Then Me.Bookmark = rst.Bookmark
Set rst = Nothing
Note: I recommend giving controls on forms and reports meaningful names. Using names such as Command51 don't give any clue to the purpose of the command button. If you name it cmdFindDate or something like that, it is immediately clear what it does.