J
jakeatkins
I'm working with a form that displays all records, but has a filter button to
show only a certain year, or all (*). Once prompted for the year in the
messagebox, hitting cancel returns me to the form but with NO records showing.
How can I hit cancel and have it go back to the form, displaying whatever
records it was before hitting the filter button? Here's my current button
code:
------------------------------------------------------------------------------
Private Sub btnFindStyle_Click()
On Error GoTo Err_btnFindStyle_Click
Dim msg, Style, Title, myResponse
msg = "Enter Year (YYYY) to Show, or * to show all:"
Title = "Enter Year"
myResponse = InputBox(msg, Title, "2007")
DoCmd.ApplyFilter , "Year Like '" & myResponse & "'"
Exit_btnFindStyle_Click:
Exit Sub
Err_btnFindStyle_Click:
MsgBox Err.Description
Resume Exit_btnFindStyle_Click
End Sub
show only a certain year, or all (*). Once prompted for the year in the
messagebox, hitting cancel returns me to the form but with NO records showing.
How can I hit cancel and have it go back to the form, displaying whatever
records it was before hitting the filter button? Here's my current button
code:
------------------------------------------------------------------------------
Private Sub btnFindStyle_Click()
On Error GoTo Err_btnFindStyle_Click
Dim msg, Style, Title, myResponse
msg = "Enter Year (YYYY) to Show, or * to show all:"
Title = "Enter Year"
myResponse = InputBox(msg, Title, "2007")
DoCmd.ApplyFilter , "Year Like '" & myResponse & "'"
Exit_btnFindStyle_Click:
Exit Sub
Err_btnFindStyle_Click:
MsgBox Err.Description
Resume Exit_btnFindStyle_Click
End Sub