Hi everyone,
I followed a tutorial to do a custom search. Works great...for the most part. When my form opens, I already have it set to show me due dates due in the next 60 days. Once I click "Clear", it clears everything...so it's just blank. If there is a way to set it back to the original state of my form, that would be great.
The other thing I would really like is to have a button that I can click that will automatically show me due dates in the next 30 days, 60 days, and 90 days. I do not know code well enough to make this work on my own.
Any help with this? Thank you in advance!
The following is my custom search code just for reference.
I followed a tutorial to do a custom search. Works great...for the most part. When my form opens, I already have it set to show me due dates due in the next 60 days. Once I click "Clear", it clears everything...so it's just blank. If there is a way to set it back to the original state of my form, that would be great.
The other thing I would really like is to have a button that I can click that will automatically show me due dates in the next 30 days, 60 days, and 90 days. I do not know code well enough to make this work on my own.
Any help with this? Thank you in advance!
The following is my custom search code just for reference.
Code:
Private Sub Command30_Click()
' Search button
Call Search
End Sub
Sub Search()
Dim strCriteria, task As String
Me.Refresh
If IsNull(Me.DateFrom) Or IsNull(Me.DateTo) Then
MsgBox "Please enter the date range", vbInformation, "Date Range Required"
Me.DateFrom.SetFocus
Else
strCriteria = "([Follow] >= #" & Me.DateFrom & "# And [Follow] <= #" & Me.DateTo & "#)"
task = "select * from Services where (" & strCriteria & ") order by [Follow]"
DoCmd.ApplyFilter task
End If
End Sub
Private Sub Command31_Click()
Dim task As String
Me.DateFrom = Null
Me.DateTo = ""
task = "select * from Services where Follow is null"
DoCmd.ApplyFilter task
End Sub
Private Sub Command32_Click()
Dim task As String
Me.DateFrom = Null
Me.DateTo = ""
task = "select * from Services order by [Follow]"
Me.RecordSource = task
End Sub